Monday, October 22, 2007

Remove MDI Child Title Bar

The BorderStyle property of a Delphi form lets you specify the appearance and behavior of the form border.

If you need to hide the title bar of a Multiple Document Interface child form, you might be tempted to set the BorderStyle to bsNone - and make the form not resizable with no visible border line.

However, for an MDI child form, setting the BorderStyle property to bsNone does NOT remove the title bar.

The only way to remove (hide) the border of an MDI child form is by messing with the CreateParams procedure:

procedure TMDIChild.CreateParams(var Params: TCreateParams) ;
inherited; := and not WS_CAPTION;

Note that removing the caption bar means the user will have a difficult time moving, sizing and closing the child.

No comments: