我今天有病!!!!!!!!!!!
为了做一个计时器(格式为 00:00:00),我编程如下:
var
Form1: TForm1;
secend:integer;
min:integer;
hour:integer;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
secend:=secend+1;
if (min<59)then
begin
if (secend>59)then
begin
min:=min+1;
secend:=0;
end;
end
else
begin
hour:=hour+1;
min:=0;
end;
if (min>9)then
begin
if (secend>9)then
label1.Caption:=inttostr(hour)+' : '+inttostr(min)+' : '+inttostr(secend)
else
label1.Caption:=inttostr(hour)+' : '+inttostr(min)+' : '+'0'+inttostr(secend);
end
else
begin
if (secend>9)then
label1.Caption:=inttostr(hour)+' : '+'0'+inttostr(min)+' : '+inttostr(secend)
else
label1.Caption:=inttostr(hour)+' : '+'0'+inttostr(min)+' : '+'0'+inttostr(secend);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
secend:=0;
min:=0;
hour:=0;
end;
end.
我今天有病!!!