delphi的倒计时
我初学啊,做了个倒计时程序,但它就是不倒计时……
请会的大哥帮忙下啊
var
Form1: TForm1;
implementation
var
wh,wm,ws,wms: Word;
nowtime: TDateTime;
{$R *.dfm}
procedure TForm1.btn1Click(Sender: T
Object);
var
endtime: TDateTime;
begin
nowtime := now ;
wh := StrToInt(edt1.Text);
wm := StrToInt(edt2.Text);
ws := StrToInt(edt3.Text);
wms:= 0;
endtime := nowtime + EncodeTime(wh,wm,ws,wms);
if now >= endtime then
begin
ShowMessage('时间到');
Exit;
end
else
begin
DecodeTime(endtime-now,wh,wm,ws,wms);
lbl3.Caption := IntToStr(wh)+':'+inttostr(wm)+':'+IntToStr(ws);
end;
end;
procedure TForm1.tmr1Timer(Sender: T
Object);
var
lt : TSYSTEMTIME;
begin
GetLocalTime(lt);
lbl1.Caption:=IntToStr(lt.wHour)+':'+inttostr(lt.wMinute)+':'+inttostr(lt.wSecond);
end;
end.