2005. június 4., szombat

Why always drag a window by its title bar?


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;

Nincsenek megjegyzések:

Megjegyzés küldése