当前位置:编程学习 > Delphi >>

delphi 倒计时程序 怎样做!

答案:用时钟啊,定义一个全局变量,然后再时钟里面将变量递减。 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Timer1: TTimer; Label1: TLabel; procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Id:integer=10; implementation {$R *.dfm} procedure TForm1.Timer1Timer(Sender: TObject); begin if Id > 0 then begin Id := Id -1; Label1.Caption := IntToStr(Id); end else begin Timer1.Enabled := False; end; end; end.
其他:time 使用Timer控件,声明一个全局的整形变量,在事件中调用(每分钟调用一次就是触发时间设置成1000ms),递减就可以了 nteger; 

上一个:哪个高手帮我决绝一下这个JSP程序嘛!中文乱码问题!
下一个:delphi可以用C#语言编程序吗?

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,