如何用delphi制作一个倒计时器?

来源:百度知道 编辑:UC知道 时间:2024/05/26 13:05:45
如何用delphi中的timer控件制作一个倒计时器?

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
Label2: TLabel;
Label3: TLabel;
BitBtn1: TBitBtn;
Edit1: TEdit;
BitBtn2: TBitBtn;
Label1: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
mm,ss,s:integer;
implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin

Label2.Caption:=inttostr(mm); //显示分钟

ss:=ss-1;
s:=s-1;
Label3.C