Mirror

Create a form with a border but without a caption (Views: 100)


Problem/Question/Abstract:

How to create a form with a border but without a caption

Answer:

{ ... }
type
  TForm1 = class(TForm)
  public
    procedure CreateParams(var Params: TCreateParams); override;
  end;

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited;
  {check if caption is set}
  if (Params.Style and WS_CAPTION) <> 0 then
  begin
    {delete caption}
    Params.Style := Params.Style xor WS_CAPTION;
    {Required: add popup style}
    Params.Style := Params.Style or WS_POPUP;
  end;
end;

<< Back to main page