procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
cl_tmp: TColor;
begin
while true do
begin
if CheckBox1.Checked then Exit;
//变红
for i:=0 to 255 do
begin
application.ProcessMessages;
cl_tmp := RGB(255,255-i,255-i);
Shape1.Brush.Color := cl_tmp;
sleep(2);
end;
//变白
for i:=255 downto 1 do
begin
application.ProcessMessages;
cl_tmp := RGB(255,255-i,255-i);
Shape1.Brush.Color := cl_tmp;
sleep(2);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
form1.DoubleBuffered := True;
end;