Thomas wrote:
> Hi Kire,
>
> If I can remember, the method to perform such operation was to hook the
> WM_NCHITTEST message and re-direct it to the caption bar ; thus, u fake a
> click on the caption bar so your form can move.
> Regards,
> Thomas.
Von: Juan Jos?Grajeda
Betreff: Re: Moving formswithout caption bar.
Datum: Dienstag, 30. März 1999 01:35
The method Thomas say is this:
[code lang=”delphi”]
TForm1 = Class(TForm);
…
private
procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;
…
end;
procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
begin
inherited;
if M.Result = htClient then { Test if you are in the client area
}
M.Result := htCaption; { change it to the caption area}
end;
[/code]
This are other ht constants
HTBORDER, HTBOTTOM, HTBOTTOMLEFT, HTBOTTOMRIGHT, HTCAPTION,
HTCLIENT, HTERROR, HTNOWHERE, HTGROWBOX, HTHSCROLL, HTLEFT,
HTMENU, HTNOWHERE, HTREDUCE, HTRIGHT, HTSIZE, HTSYSMENU,
HTTOP, HTTOPLEFT, HTTOPRIGHT – Canto direito superior da janela
HTTRANSPARENT, HTVSCROLL, HTZOOM
Regards,
Juan Jose
To hook the WM_NCHITTEST message is only the solution if the user has
the possibility to do a click at the form directly. If the form is
covered by e.g. a panel then you can use
[code lang=”delphi”]procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
const
SC_DRAGMOVE = $F012; // a magic number, no idea where it’s documented
begin
if Button = mbLeft then
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
end;
end;
[/code]
Good luck!
Toni
Toni Sanders wrote:
> SC_DRAGMOVE = $F012; // a magic number, no idea where it’s documented
That Number comes from: SC_DRAGMOVE = SC_Move + htCaption
this command emulates the the user action clicking the caption of a window to move.
If you don’t add htCaption the command is handled by the keyboard instead.
best regards
Juan Jose
[tags]Delphi, Forms[/tags]
0 Kommentare zu “Moving Forms without a caption bar”