How to remove the title bar from a form
11,790
Solution 1
First, set BorderStyle
to bsNone
at design-time. Then declare the procedure CreateParams
like so:
type
TForm1 = class(TForm)
private
protected
procedure CreateParams(var Params: TCreateParams); override; // ADD THIS LINE!
{ Private declarations }
public
{ Public declarations }
end;
and implement it like
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.Style := Params.Style or WS_THICKFRAME;
end;
Solution 2
Set BorderStyle
to bsNone
in Object Inspector
Solution 3
For better border style, you can add the WS_BORDER flag.
Like this:
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.Style := Params.Style or WS_BORDER or WS_THICKFRAME;
end;
Note than a soft line is drawn inside the border frame.
Related videos on Youtube
Author by
Hatem Hidouri
Updated on June 04, 2022Comments
-
Hatem Hidouri almost 2 years
Does anyone know how to create a Delphi form without a title bar? I have seen some some links/tips but its not exactly what I want and I couldn't do it myself.
This is what I am trying to achieve:
-
Andreas Rejbrand over 11 yearsThat alone isn't sufficient.
-
Andreas Rejbrand over 11 yearsCompare the result with the image supplied by the OP. The entire glass border (and shadow) is gone.
-
TLama over 11 yearsDoes it look and behave properly also on Windows XP ? [+1]
-
Andreas Rejbrand over 11 years@TLama: Don't remember and have no XP to test on, but there shouldn't be any problems, I think. (Doesn't it get a blue thick border instead of the glass one?)
-
Hatem Hidouri over 11 yearsThanks Andreas, is there a way to modify the border size?
-
Andreas Rejbrand over 11 years@HatemHidouri: That's an OS-wide setting (probably per-user).
-
Hatem Hidouri over 11 yearsI see now. Thank you again
-
VitorMM about 4 yearsI know this is a pretty old question, but just confirming: it does work in XP, although it does not create the regular blue thick border. Instead, it creates a grey thiner border (
Params.Style or WS_BORDER or WS_THICKFRAME
also does that). Still resizable thought.