C# – Child Form Size Set to the MDI Form’s MDI Container’s Size

cformsmdi

I'd like to know how I can have a child form load up with it's size covering the complete MDI Parent's MDI container space (the dark-gray thing)? Setting the child form's WindowState to Maximized is not an option as it'll maximize any other form too. Suggestions?

Best Answer

I think this code should do it:

Form childForm = new Form();
f.Left = 0;
f.Top = 0;
f.Size = ParentForm.ClientRectangle.Size;