interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm_Stop_Watch_Almizan = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Timer1: TTimer;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_Stop_Watch_Almizan: TForm_Stop_Watch_Almizan;
Awal,akhir:TTime;
implementation
uses Unit1_Praktikum1_Almizan, Perpustakaan_Almizan,
Tugas_Pratikum_Almizan;
{$R *.dfm}
procedure TForm_Stop_Watch_Almizan.BitBtn1Click(Sender: TObject);
begin
if BitBtn1.Caption= 'start' then
begin
awal:=Time;
Edit1.Text:=TimeToStr(Time);
BitBtn1.Caption:='stop';
end
else if BitBtn1.Caption='stop' then
BitBtn1.Caption:='selesai'
else
close;
Form2.Show;
end;
procedure TForm_Stop_Watch_Almizan.Timer1Timer(Sender: TObject);
Var
SLama :string;
Lama :Double;
begin
if BitBtn1.Caption='stop' then
begin
akhir:=Time;
Edit2.Text:=TimeToStr(akhir);
Lama:=(akhir-Awal)*1000;
str(lama:12:2,Slama);
Edit3.Text:=SLama;
end;
end;
procedure TForm_Stop_Watch_Almizan.FormCreate(Sender: TObject);
begin
Timer1.Interval:=1000;
BitBtn1.Caption:='start';
BitBtn2.Caption:='reset';
end;
procedure TForm_Stop_Watch_Almizan.BitBtn2Click(Sender: TObject);
begin
FormCreate(sender);
FormShow(Sender);
end;
procedure TForm_Stop_Watch_Almizan.FormShow(Sender: TObject);
begin
Edit1.Text:='00:00:00';
Edit2.Text:='00:00:00';
Edit3.Text:='00:00';
end;
end.
vidio:
Tidak ada komentar:
Posting Komentar