Klatsch ne Shape (Shape1) auf die Form und füge diesen Code ein...
Delphi-Quellcode:
TForm1 = class(TForm)
Shape1: TShape;
procedure Shape1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
procedure Shape1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
procedure Shape1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
private
{ Private-Deklarationen }
public
sh1MouseDown: Boolean;
sh1MousePos: TPoint;
end;
{...}
procedure TForm1.Shape1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
sh1MouseDown := True;
sh1MousePos := Point( X, Y );
end;
procedure TForm1.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if sh1MouseDown then
begin
Shape1.Left := Shape1.Left + X - sh1MousePos.X;
Shape1.Top := Shape1.Top + Y - sh1MousePos.Y;
end;
end;
procedure TForm1.Shape1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
sh1MouseDown := False;
end;
Ersetze anschließend Shape mit Image...
MfG