如何让标签闪烁?请各位前辈相助,小弟在线等待! 我想在窗体上的标签能够闪烁,应该如何做到,请各位前辈相助,小弟在线等待!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 放一个timer,在ontimer事件中,修改label的font.color属性 放一个TIMER控件,在事件下:begin if Label1.Font.color:=clRed then Label1.Font.Color:=clWhite else Label1.Font.Color:=clRed;end; 你想怎么闪法呢.加入一个timer控制....然后你想让他怎么闪都行了,就像" xzhifei(星级饭桶(抵制日货)·飞"所说的. 给你一个简单的,推荐用楼上的Timer方法:type TFlashLabel = class(TThread) private { Private declarations } protected procedure Execute; override; end; TForm1 = class(TForm) Label1: TLabel; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } procedure FlashLabel; public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FlashLabel;begin Label1.Color := clLime; Label1.Repaint; Sleep(500); Label1.Color := clSkyBlue; Label1.Repaint; Sleep(500); Label1.Color := clLime; Label1.Repaint; Sleep(500); Label1.Color := clSkyBlue; Label1.Repaint; Sleep(500);end;procedure TForm1.Button1Click(Sender: TObject);begin TFlashLabel.Create(false);end;{ FlashLabel }procedure TFlashLabel.Execute;begin inherited; self.FreeOnTerminate := true; Form1.FlashLabel;end; 如果不想处理的过于复杂,一个timer就可以处理了 weizi2000(秋风啊) 你用sleep() 的办法会使软件和死机一样。只要改一下timer的间隔时间就行了。 1、最好不要用第三方控件,虽然也没有什么大碍,但有些时候很难缠。2、用TIMER实现最好了,但尽量不要用SLEEP(X),会降低程序效率。 nSCSI(摩洛客中文論壇):不会的,你再看看;我加它在一个单独的线程里,否则我也不用贴那么多了 可以在Timer下编程Procedure TForm1.Timer1Timer(sender:object)begin label1.visible:=not label1.visible;end; 热键为什么不起作用? 向 高手们 请教问题。。 请问如何访问本程序里webbrowser里javascript的函数? 谢谢 求高人指点迷津!!! 对于delphi调用vc Dll函数,参数传地址的方式如何完成!!! 关于EhLib里的打印控件... 如何在三层结构中启动事务???? 三层模式数据库开发问题 ??? 关于彩票系统 关于Delphi中Indy9.0控件TIdTCPClient和TIdTCPServer的多线程使用问题,请高手指教 请教:toolbar问题 IDFTP递归删除远程目录问题! SQL server 7.0 要建何种字段可以保存进自定义文件?
begin
if Label1.Font.color:=clRed then
Label1.Font.Color:=clWhite
else
Label1.Font.Color:=clRed;
end;
然后你想让他怎么闪都行了,就像" xzhifei(星级饭桶(抵制日货)·飞"所说的.
type
TFlashLabel = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
end; TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure FlashLabel;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FlashLabel;
begin
Label1.Color := clLime;
Label1.Repaint;
Sleep(500);
Label1.Color := clSkyBlue;
Label1.Repaint;
Sleep(500);
Label1.Color := clLime;
Label1.Repaint;
Sleep(500);
Label1.Color := clSkyBlue;
Label1.Repaint;
Sleep(500);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
TFlashLabel.Create(false);
end;{ FlashLabel }procedure TFlashLabel.Execute;
begin
inherited;
self.FreeOnTerminate := true;
Form1.FlashLabel;
end;
2、用TIMER实现最好了,但尽量不要用SLEEP(X),会降低程序效率。
Procedure TForm1.Timer1Timer(sender:object)
begin
label1.visible:=not label1.visible;
end;