unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
PROCEDURE ZaehleEinsHoch(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1 : TForm1;
Timer1: TTimer;
k : INTEGER;
implementation
{$R *.DFM}
PROCEDURE TForm1.ZaehleEinsHoch(Sender: TObject);
VAR s: STRING;
begin
Inc(k);
Str(k,s);
Label1.Font.Color := Random($FFFFFF);
Label1.Caption := s
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
(* Timer1 intantiieren *)
Timer1 := TTimer.Create(Self);
(* Eigenschaften von Timer1 festlegen *)
(* (hier nur "Interval") *)
Timer1.Interval := 500;
(* Ereignisverknüpfung für Timer1 festlegen *)
(* (hier nur "OnTimer") *)
Timer1.OnTimer := ZaehleEinsHoch;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
(* Timer1 lebewohl sagen *)
Timer1.Destroy
end;
begin
k := 0
end.