If at all possible, I suggest you do not use the MDI WinForm architecture for your application; it's outmoded; it's visually unappealing; and, there are better ways to construct a UI that has contained elements (use UserControls, or Panels, or use a TabControl).
A WinForm can never be both
an MDIParent Form and an MDIChild Form; I hope you didn't have that in mind, here. While you can, indeed, make a Form contained within another Form (not an MDIParent Form), I strongly suggest you never do that.
1. in your Main Form (the MDIParent), create instances of all the Forms you will need to show as MDIChild Forms.
2. show these Child Forms when you need to.
3. if you want an event in a Child Form to cause some change in the MDI UI, like opening another Child Form:
3.a. in ChildForm1:
public Action NotifyMainFormToOpenChildForm2;
private void btnNotify_Click(object sender, EventArgs e)
if (NotifyMainFormToOpenChildForm2 != null)
3.b. in the MDI Parent Form:
private ChildForm1 cForm1;
private ChildForm2 cForm2;
private void MDIParentForm_Load(object sender, EventArgs e)
cForm1 = new ChildForm1();
cForm1.MdiParent = this;
cForm1.NotifyMainFormToOpenChildForm2 += NotifyMainFormToOpenForm2;
cForm2 = new ChildForm2();
cForm2.MdiParent = this;
private void NotifyMainFormToOpenForm2()
In this example we inject a pointer to the executable code that opens ChildForm2 (in the MDIParentForm) into ChildForm1. We used a delegate to do this, a delegate of Type Action which gives us an easy to use syntax.
When the Button is clicked in ChildForm1, it checks to see if there is a valid reference to code in the Action delegate, and, if there is, it executes that code which is located in the handler on the MDIParentForm, and that code show ChildForm2.
Re the problem of being able to drag MDI Child Forms so they are partially outside the boundaries of the MDI Parent Form: well, that's one of the flaws of the MDI model, imho. Getting that to work right requires using the Windows API to suppress showing ScrollBars because of an internal flaw in the Control.
I have run out of time for today (GMT +7), but if you post another question about the issue of constraining Child Forms to the boundaries of an MDI Parent Form ... and you have made some attempt to solve that problem for yourself, I will respond.