Windows MDI child form doesnt open in WIndowMaximized state

Sandeep Pathak picture Sandeep Pathak · Sep 9, 2010 · Viewed 18.9k times · Source

I have set a form as a child of an MDI form which has its WindowState set to Maximized.

When I open that form from an MDI container, it doesn't open in Maximized state. Why is this happening and how can I make it open maximized?

This is how I am showing child form from mdi container.

private void ShowNewForm(object sender, EventArgs e)
{
    FormChild childForm = new FormChild ();
    childForm.MdiParent = this;
    childForm.WindowState = FormWindowState.Maximized;
    childForm.Text = "Window " + childFormNumber++;
    childForm.Show();
}

Answer

Somu picture Somu · Mar 17, 2013

Found the best possible method to solve this.. Just use two lines :

frm r = new frm();
r.MdiParent = this;
r.Show();
r.WindowState = FormWindowState.Minimized;
r.WindowState = FormWindowState.Maximized;

As it turns out, the desired result is obtained, if the form is first minimized, and then maximized!