C# – Child Form is hidden behind MDI Parent Container

cmdinetvisual studiowinforms

When a child form is opened it is hidden behind the title bar of MDI Parent Container.

enter image description here

The Child form's WindowState is set to Maximized. FormBorderStyle is set to None.

If I minimize the MDI parent and maximize it, then the child form comes in to front.

How to overcome this situation?

Edit:

I use the following code to open a child form.

    this.childForm= new ChildForm();
    this.childForm.MdiParent = this;
    this.WindowState = FormWindowState.Maximized;

    this.childForm.Dock = DockStyle.Fill;
    this.childForm.Show();
    this.childForm.BringToFront();
    this.childForm.Focus();

Best Answer

Try the following code.

    Form1 newMDIChild = new Form1();
    newMDIChild.MdiParent = this;
    newMDIChild.Show();
    this.LayoutMdi(MdiLayout.Cascade);
    newMDIChild.Dock = DockStyle.Fill;