简体   繁体   English

如何在Delphi中为TLabel创建淡入和淡出效果

[英]How to create fade in and fade out effects for TLabel in Delphi

When a user click on label, it changes its color for some milliseconds and then returns to its previous color. 当用户单击标签时,它会更改其颜色几毫秒,然后返回其先前的颜色。

How to simulate this effect in Delphi? 如何在Delphi中模拟这种效果?

One way would be set the font color when you click the item. 一种方法是单击该项目时设置字体颜色。 Then start a TTimer : 然后启动一个TTimer

Label.Font.Color := <insert your highlight color>;
TimerEffects.Enabled := true;

When the timer fires do something like this: 当计时器触发时,请执行以下操作:

TimerEffects.Enabled := false;
Label.Font.Color := clBLack; // whatever color you want to set the label back to

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

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