// Forma bir timer, ,iki buton ve 3 tanede label ekleyin
var
zaman, zaman1, zaman2 : integer ;
durdur : boolean = false ;
procedure TMainForm.Button3Click(Sender: TObject);
begin
if durdur = false then
begin
Button3.Caption := 'Durdur' ;
timer1.Enabled := true ;
durdur := true ;
Button4.Enabled := false ;
end else
begin
Button3.Caption := 'Devam et' ;
Button4.Enabled := True ;
timer1.Enabled := true ;
durdur := false ;
end ;
end;
procedure TMainForm.Timer1Timer(Sender: TObject);
begin
if durdur then
begin
inc(zaman) ;
Label7.Caption := SifirEkle(IntToStr(zaman)) ;
if zaman = 100 then
begin
Label7.Caption := '00' ;
zaman := 00 ;
inc(zaman1) ;
Label8.Caption := SifirEkle(IntToStr(zaman1)) ;
if zaman1 = 60 then
begin
Label8.Caption := '00' ;
zaman1 := 00 ;
inc(zaman2) ;
Label9.Caption := SifirEkle(IntToStr(zaman2)) ;
if zaman2 = 60 then
begin
Label7.Caption := '00' ;
Label8.Caption := '00' ;
Label9.Caption := '00' ;
zaman2 := 00 ;
end ;
end ;
end ;
end ;
end;
Function TMainForm.SifirEkle(Sayi : String) : String;
var
a:Integer;
begin
//" 1" yerine "01" olmasını sağlıyor.
result := sayi;
for a := 1 downto Length(Sayi) Do Result :='0'+Result;
end;
procedure TMainForm.Button4Click(Sender: TObject);
begin
Button3.Caption := 'Başla' ;
label7.Caption := '00';
label8.Caption := '00';
label9.Caption := '00';
zaman := 00 ;
zaman1 := 00 ;
zaman2 := 00 ;
end;