unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
lblmouseX: TLabel;
//Erkärung welcher Wert
lblmouseY: TLabel;
//Erkärung welcher Wert
lblwidth: TLabel;
//Erkärung welcher Wert
lbltop: TLabel;
//Erkärung welcher Wert
lblleft: TLabel;
//Erkärung welcher Wert
lblheight: TLabel;
//Erkärung welcher Wert
lbMouseX: TLabel;
//Darstellung des Wertes
lbMouseY: TLabel;
//Darstellung des Wertes
lbLeft: TLabel;
//Darstellung des Wertes
lbHeight: TLabel;
//Darstellung des Wertes
lbWidth: TLabel;
//Darstellung des Wertes
lbTop: TLabel;
//Darstellung des Wertes
procedure FormCreate(Sender: TObject);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private-Deklarationen }
DeltaX,DeltaY: Integer;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
lbLeft.Caption := IntToStr(Left);
lbTop.Caption := IntToStr(Top);
lbWidth.Caption := IntToStr(Width);
lbHeight.Caption := IntToStr(Height);
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
LbMouseX.Caption := IntToStr(X);
LbMouseY.Caption := IntToStr(Y);
DeltaX := X - Left;
//Differenz linke obere Ecke und
DeltaY := Y - Top;
//Mausposition
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if ssLeft
in Shift
Then
begin
MouseX := X;
MouseY := Y;
DeltaX := MouseX - Left;
DeltaY := MouseY - Top;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Left := Left - DeltaX;
Top := Top - DeltaY;
lbLeft.Caption := IntToStr(Left);
lbTop.Caption := IntToStr(Top);
end;
end.