text maarque kanan

INGATKAN DIRIMU UNTUK MENGATUR SEGALA SESUATU SUDAH DI ATUR ALLOH

salju

Senin, 12 Desember 2011

jam Delphi

Menampilkan jam pada title Bar PDF Print E-mail
User Rating: / 0
PoorBest 
Delphi - Tips dan Trik Delphi
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Label1: TLabel;
    Button1: TButton;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  dc: hDC;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
var
  TheTime: array[0..80] of char;
begin
  StrPCopy(TheTime, TimeToStr(time));
  TextOut(dc, width DIV 2, 5, TheTime, StrLen(TheTime));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  dc := GetWindowDC(handle);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  ReleaseDC(handle, dc);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;

end.

Tidak ada komentar:

Posting Komentar