unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Button: TButton;
implementation
{$R *.dfm}
procedure ControlMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Form1.Caption := '
ControlMouseDown';
end;
procedure ControlMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
Form1.Caption := '
ControlMouseMove';
end;
procedure ControlMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Form1.Caption := '
ControlMouseUp';
end;
procedure ControlClick(Sender: TObject);
begin
Form1.Caption := IntToStr(GetTickCount);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Button := TButton.Create(
nil);
Button.Left := 100;
Button.Top := 100;
Button.Width := 100;
Button.Height := 25;
@Button.OnClick := @ControlClick;
@Button.OnMouseMove := @ControlMouseMove;
@Button.OnMouseDown := @ControlMouseDown;
@Button.OnMouseUp := @ControlMouseUp;
Button.Parent := Form1;
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Button.Free;
end;
end.