2008. november 15., szombat

Moving a form with a mouse click on client area


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;

Nincsenek megjegyzések:

Megjegyzés küldése