Hatem Hidouri
Hatem Hidouri

Reputation: 143

How to remove the title bar from a form

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:

enter image description here

Upvotes: 14

Views: 13966

Answers (3)

Smaniotto
Smaniotto

Reputation: 31

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.

Upvotes: 3

Andreas Rejbrand
Andreas Rejbrand

Reputation: 108929

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;

Upvotes: 18

iMan Biglari
iMan Biglari

Reputation: 4776

Set BorderStyle to bsNone in Object Inspector

Upvotes: 3

Related Questions