Mirror

Moving a form with a mouse click on client area (Views: 703)


Problem/Question/Abstract:

You want to move your TForm with a mouse click on the client area? No Problem.

Answer:

Insert the following code in the OnMouseDown-Event of your form:

procedure LetMoveWindow(Window: TControl);
begin
  ReleaseCapture;
  Window.Perform(WM_SysCommand, 61458, 0);
end;

procedure TForm1.FormMouseDown(Sender: TObject);
begin
  LetMoveWindow(Self);
end;

<< Back to main page