Reputation: 6671
When a child form is opened it is hidden behind the title bar of MDI Parent Container.
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();
Upvotes: 4
Views: 7409
Reputation: 35
AboutBox1 ab = new AboutBox1();
ab.MdiParent = MDIForm.ActiveForm;
ab.TopMost = true;
ab.Show();
Upvotes: 0
Reputation: 291
Try the following code.
Form1 newMDIChild = new Form1();
newMDIChild.MdiParent = this;
newMDIChild.Show();
this.LayoutMdi(MdiLayout.Cascade);
newMDIChild.Dock = DockStyle.Fill;
Upvotes: 4
Reputation: 942247
The native Windows MDI implementation cannot deal with borderless MDI child windows. Unfortunately, Winforms forgets to enforce that restriction. You can move the WindowState assignment after the Show() call but that causes another problem.
Just don't make it borderless, the border isn't visible anyway.
Upvotes: 3