请求30秒倒计时程序
因工作需要一个30秒倒计时程序,望不吝赐教。
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; Timer1: TTimer; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button5Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses Unit2, TimerDlg; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin SetDlgAutoClose(15*1000, True); ShowMessage('This message box will close automatically,' + #13#10 + 'after fifteen seconds.'); end; procedure TForm1.Button3Click(Sender: TObject); begin SetDlgAutoClose(8000, Sender = Button3); MessageBox(Handle, PChar('这是一个测试例子' + #13#10 + '此消息框将在 8 秒钟后自动关闭' + #13#10 + '只需要在调用消息框和对话框之前调用一个函数' + #13#10 + '就可以方便的实现这种效果'), '定时自动关闭的消息框', MB_ICONINFORMATION or MB_OKCANCEL); end; procedure TForm1.Button2Click(Sender: TObject); var dlg: TDlgTest; begin SetDlgAutoClose(8*1000, True); dlg := TDlgTest.Create(Self); dlg.ShowModal; dlg.Free; end; procedure TForm1.Button5Click(Sender: TObject); begin ShowMessage('Normal ShowMessage'); end; end.