My problem is that I want the child form to occupy the free space of the MDI container
Here's the code I tried
In my MDI container form load event I have this line of code calling the child form
childform = new ppt.MyChildForm();
childform.MdiParent = this;
childform.Size = childform.MdiParent.ClientSize;
childform.Show();
But what happen is that I think the child form is larger than its parent because it contains a scrollbar how can I fix this?
If AutoSize
property is set to true, changing of Size
has no effect.
A better practice is to set the Dock
property of the child form to DockStyle.Fill
. It will always fill the entire client size of its parent, so you have not to worry about parent resizing.