procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if isCacthMouseDown then
begin
isCacthMouseDown := False;
end
else
begin
isCacthMouseDown := True;
end;
mouseX := X;
mouseY := Y;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if isCacthMouseDown then
begin
Button1.Left := X - mouseX;
Button1.Top := Y - mouseY;
end;
end;