2007. december 5., szerda

How to remove the title bar of a MDI child form


Problem/Question/Abstract:

I want the form only to appear once on the user's desktop regardless of whether it has focus or not.

Answer:

Solve 1:

type
  TForm2 = class(TForm)
    {other stuff above}
    procedure CreateParams(var Params: TCreateParams); override;
    {other stuff below}
  end;

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


Solve 2:

For a MDI child form, setting the BorderStyle to bsNone does not remove the title bar. This does it:

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

Nincsenek megjegyzések:

Megjegyzés küldése