unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, XPMan, StdCtrls;
type
TForm1 =
class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
XPManifest1: TXPManifest;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Label1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1; min, sec: Integer; mins, secs:
string;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
min:=0;
sec:=0;
Timer1.Enabled:=True;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Button1.Enabled:=False;
sec:= sec+1;
if sec=60
then begin min:=min+1; sec:=0;
end;
if sec<10
then secs:='
0'+ IntToStr(sec);
if sec>9
then secs:=IntToStr(sec);
if min<10
then mins:='
0'+ IntToStr(min);
if min>9
then mins:=IntToStr(min);
Label1.Caption:= mins '
:' secs;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if Button2.Caption='
Pause'
then
begin Timer1.Enabled:=False; Button2.Caption:='
Restart';
end
else begin Timer1.Enabled:=True; Button2.Caption:= '
Pause';
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Timer1.Enabled:= False; Label1.Caption:='
00:00';
end;
end.