简体   繁体   English

Delphi TButton组件样式

[英]Delphi TButton component styling

I just want to apologize in advanced if this question is already in another thread. 如果这个问题已经在其他话题中,我只想向高级致歉。 I am also relatively new to Delphi. 我对Delphi也比较陌生。

Today I have seen an example Delphi program that has TButton components on it. 今天,我看到了一个示例Delphi程序,上面带有TButton组件。 The buttons have a pulsating blue effect that I assume is part of the Windows styling. 这些按钮具有蓝色的脉动效果,我认为这是Windows样式的一部分。 There is absolutely no code written to make the button this way. 绝对没有编写任何代码来使按钮变成这种方式。 I have searched for a possible setting, but to no avail. 我已经搜索了可能的设置,但无济于事。

Note: The buttons makes the effect at run-time and there is no custom components installed. 注意:这些按钮会在运行时生效,并且没有安装自定义组件。

If someone could give me some information about how to do this without code, maybe just a setting would be great. 如果有人可以在没有代码的情况下给我一些有关如何执行此操作的信息,则可能只是一个设置就可以了。

I am using Delphi 7 (2002). 我正在使用Delphi 7(2002)。

Delphi Firemonkey (FMX) component framework has a TColorAnimation for which you can set properties like Duration, StartValue, StopValue, trigger etc. The FMX framework was introduced in Delphi XE2. Delphi Firemonkey(FMX)组件框架具有TColorAnimation ,您可以TColorAnimation设置诸如Duration,StartValue,StopValue,trigger等属性。FMX框架是在Delphi XE2中引入的。

Blinking button demo 闪烁按钮演示


Now that you have clarified that you use Delphi 7 (please remember in future to indicate the version), here's an alternative that works in Delphi 7 (FMX is not compatible with Delphi 7) 既然您已经确认使用了Delphi 7(请记住,请在以后指出版本),以下是在Delphi 7中可用的替代方法(FMX与Delphi 7不兼容)

var
  b: boolean;

procedure TForm9.Timer1Timer(Sender: TObject);
begin
  b := not b;
  if b then
    Button1.Perform(BM_SETSTATE, 0, 0)
  else
    Button1.Perform(BM_SETSTATE, 1, 0);
end;

Flashing is controlled by a TTimer, eg 500 ms. 闪烁由TTimer控制,例如500 ms。

However, this doesn't fulfill your requirement of "There is absolutely no code written to make the button this way." 但是,这不能满足您的要求: “绝对没有编写任何代码来使按钮以这种方式进行。” , but I'm not aware of any way to achieve that. ,但我不知道有什么方法可以实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM