Search code examples
formsdelphivcldelphi-xe8

How to set MDI child form border to none?


On my MDI Form (Parent Form), whenever I trigger a command to create a new MDI Child Form, I do these stuff (but it doesn't work):

procedure TfrmMDI.CreateChildForm(const childName: string);
var Child: TfrmChild;
begin
    Child := TfrmChild.Create(Application);
    Child.Caption := childName;
    Child.BorderStyle := bsNone;
end;

I tried to set the Border Style of the MDI Child Form to bsNone through object inspector but it doesn't work as well.

I finally tried to set the MDI Child's Form BorderStyle through run-time however, it doesn't seemed to work too.

procedure TfrmChild.FormCreate(Sender: TObject);
begin
    BorderStyle := bsNone;
end;

For additional information, my current MDI Child Form looks like this:

Current Form

We may want to set our MDI Child's BS like this MDI Parent's BS:

Desired Form


Solution

  • What you are attempting to do is not how MDI is meant to be used. The GUI you want to have would likely be better served by using client-aligned TFrame objects instead of MDI child forms.