Link to home
Start Free TrialLog in
Avatar of kotik
kotik

asked on

Resizeable window without title bar

How can I create a window without the title bar, but with a sizing grip in right-bottom corner or a status bar?
(As in IE 5.0)
Avatar of kotik
kotik

ASKER

I tried to handle WM_SIZE and WM_SIZING messages, but it works only of the new size is less then the old.
I use a form with a BorderStyle = bsNone and an inherited StatusBar with overriden CreateParams proc:

procedure TFlatStatusBar.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.Style := Params.Style or SBARS_SIZEGRIP;
end;
Handle WM_HITTEST message, and if cursor in place you want just return htBottomLeft.

Avatar of kotik

ASKER

Slavak!
How it can help me to resize the StatusBar's parent window?
Hi kotik,
for hiding the Caption you could use:

Procedure TForm1.HideTitlebar;
Var
  Save : LongInt;
Begin
  If BorderStyle=bsNone then Exit;
  Save:=GetWindowLong(Handle,gwl_Style);
  If (Save and ws_Caption)=ws_Caption then Begin
    Case BorderStyle of
      bsSingle,
      bsSizeable : SetWindowLong(Handle,gwl_Style,Save and
        (Not(ws_Caption)) or ws_border);
      bsDialog : SetWindowLong(Handle,gwl_Style,Save and
        (Not(ws_Caption)) or ds_modalframe or ws_dlgframe);
    End;
    Height:=Height-getSystemMetrics(sm_cyCaption);
    Refresh;
  End;
end;

Procedure TForm1.ShowTitlebar;
Var
  Save : LongInt;
begin
  If BorderStyle=bsNone then Exit;
  Save:=GetWindowLong(Handle,gwl_Style);
  If (Save and ws_Caption)<>ws_Caption then Begin
    Case BorderStyle of
      bsSingle,
      bsSizeable : SetWindowLong(Handle,gwl_Style,Save or ws_Caption or
        ws_border);
      bsDialog : SetWindowLong(Handle,gwl_Style,Save or ws_Caption or
        ds_modalframe or ws_dlgframe);
    End;
    Height:=Height+getSystemMetrics(sm_cyCaption);
    Refresh;
  End;
end;

Regards Michael

Avatar of kotik

ASKER

Hi, Michael!
That helped me, so you can get points.
I only don't understand why this code don't work:

procedure TTblEditForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.Style := Params.Style and not (WS_CAPTION) or WS_BORDER;
end;

ASKER CERTIFIED SOLUTION
Avatar of PROGRAMMING030999
PROGRAMMING030999

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial