Kamis, 06 Maret 2014

Jam Digital (Dhelpi)

    Kembali lagi saya posting program sederhana dari Dhelpi yaitu program jam digital , berikut contoh program dan syntax dari program tersebut :


unit Unit1;

interface

uses
  SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms,
  QDialogs, QStdCtrls, QExtCtrls;

type
  TForm1 = class(TForm)
    LCDNumber1: TLCDNumber;
    Timer1: TTimer;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Timer1Timer(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Running :boolean;
  awal,lama:Extended;

implementation

{$R *.xfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  lama:=Now-Awal;
  if Running then LCDNumber1.Value:=FormatDateTime('nn:ss:zzz',lama);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Running:=True;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 Running:=False;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
 Running:=False;
 awal:=Now;
 LCDNumber1.Value:='00:00:000';
end;

end.

0 komentar

Posting Komentar