RAD Studio 10.4 test √
1. The main attributes of Timer
Attributes | Attribute explanation |
---|---|
Enabled | When the value is True, the timer is turned on, otherwise the timer is turned off. The default value is true. |
Interval | Control the time interval of OnTimer event triggering, in milliseconds. Setting Interval to 0 is equivalent to turning off the timer. The default value is 1000ms (1 second). |
2. The main event of
Timer Timer has only one OnTimer event. When the Timer is turned on, every time the interval specified by the Interval property passes, the Timer will trigger the OnTimer event to execute the program.
Controls : Timer, scGPGlyphButton
code roughly means to do things through the Interval of the timer, set the opacity of the color when scGPGlyphButton gets focus, mouse up and lose focus, to achieve the effect of fade out and fade in.
//全局变量int1,state1
var
int1: Integer = 0;
state1: String = '停止';
***************************************************************
procedure TMainF.scGPGlyphButton1MouseEnter(Sender: TObject); // 鼠标进入事件
begin
int1 := 0;
state1 := '开始';
end;
procedure TMainF.scGPGlyphButton1MouseLeave(Sender: TObject); // 鼠标离开事件
begin
state1 := '停止';
end;
procedure TMainF.Timer1Timer(Sender: TObject);
var
i: Integer;
begin
i := int1;
if state1 = '开始' then
begin
if ((0 <= i) and (i < 255)) then
begin
MainF.scGPGlyphButton1.Options.HotColorAlpha := i;
i := i + 1;
Memo1.Lines.Add(IntToStr(i));
int1 := i;
end;
end
else if state1 = '停止' then
begin
if ((0 < i) and (i <= 255)) then
begin
i := i - 1;
MainF.scGPGlyphButton1.Options.NormalColorAlpha := i;
MainF.scGPGlyphButton1.Options.FocusedColorAlpha := i;
Memo1.Lines.Add(IntToStr(i) + '减去');
int1 := i;
end;
end;
end;
A little bit of notes recorded during study, so that you can read it later.