Mirror

Why always drag a window by its title bar? (Views: 101)


Problem/Question/Abstract:

Why always drag a window by its title bar?

Answer:

If you want to give your users the ability to move your application by dragging it
by clicking anywhere on your application window (see Windows 3.1's Clock application),
here's what you can do:

private

procedure WMNCHitTest(var Msg: TWMNCHitTest);
  message wm_NCHitTest;

..

procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
  inherited;
  if htClient = Msg.Result then
    Msg.Result := htCaption;
end;

<< Back to main page