[Lazarus] How do you remove form caption area?
silvioprog
silvioprog at gmail.com
Sat Oct 5 16:41:13 CEST 2013
2013/10/5 silvioprog <silvioprog at gmail.com>
> uses
> unit2;
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> Form2 := TForm2.Create(Self);
> Form2.ShowModal;
> Form2.Free;
> end;
>
> ---
>
> uses
> Windows;
>
> procedure TForm2.FormShow(Sender: TObject);
> begin
> SetWindowLong(Handle, GWL_STYLE,
> GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION));
> SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0,
> SWP_DRAWFRAME or SWP_NOMOVE or SWP_NOSIZE);
> end;
>
In mainform:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Windows, Forms;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormShow(Sender: TObject);
private
procedure WMNCHitTest(var Msg: TMessage); message WM_NCHITTEST;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.FormShow(Sender: TObject);
begin
SetWindowLong(Handle, GWL_STYLE, WS_OVERLAPPEDWINDOW and (not
WS_CAPTION));
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_DRAWFRAME or
SWP_NOMOVE or SWP_NOSIZE);
end;
procedure TForm1.WMNCHitTest(var Msg: TMessage);
begin
inherited;
case Msg.Result of
HTTOP: Msg.Result := HTCLIENT;
HTTOPLEFT: Msg.Result := HTCLIENT;
HTTOPRIGHT: Msg.Result := HTCLIENT;
HTBOTTOM: Msg.Result := HTCLIENT;
HTBOTTOMLEFT: Msg.Result := HTCLIENT;
HTBOTTOMRIGHT: Msg.Result := HTCLIENT;
HTLEFT: Msg.Result := HTCLIENT;
HTRIGHT: Msg.Result := HTCLIENT;
end;
end;
end.
--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131005/f9e150c1/attachment-0003.html>
More information about the Lazarus
mailing list