First:
Form room = new room (); // room is the new form name
For (INT x = 0; x <this. mdichil.pdf. length; X ++)
{
Form tempchild = (form) This. mdichil.pdf [x];
Tempchild. Close ();
}
Room. mdiparent = this;
Room. windowstate = formwindowstate. maximized;
Room. Show ();
Second:
// Query whether the form already exists by the form name. If yes, it is displayed. Otherwise, a new form is created.
If (this. checkchildfrmexist ("subjectsetting") = true)
{
Return;
}
Subjectsetting newfrm = new subjectsetting (); // subjectsetting is the new form name.
Newfrm. mdiparent = this;
Newfrm. Show ();
// ---------------------- query whether the MDI child form has a limit
private bool checkchildfrmist (string childfrmname)
{< br> foreach (Form childfrm in this. mdichil.pdf)
{< br> If (childfrm. name = childfrmname) // use the name of the child form to determine whether the child form exists. If so, activate the child form
{< br> If (childfrm. windowstate = formwindowstate. minimized)
childfrm. windowstate = formwindowstate. normal;
childfrm. activate ();
return true;
}< BR >}< br> return false;
}