From: http://virusswb.cnblogs.com/
Using System;
Using System. Collections. Generic;
Using System. componentmodel;
Using System. Data;
Using System. drawing;
Using System. text;
Using System. Windows. forms;
Namespace Windowsapplication4
{
Public Partial Class Frmmain: Form
{
Public Frmmain ()
{
Initializecomponent ();
}
Private Void Log on to toolstripmenuitem_click ( Object Sender, eventargs E)
{
Foreach (Form In Application. openforms)
{
If (Form. Name = " Frmlogin " )
{
Form. Activate ();
Form. windowstate=Formwindowstate. maximized;
Return;
}
}
Frmlogin Login = New Frmlogin ();
Login. mdiparent = This ;
Login. windowstate = Formwindowstate. maximized;
Login. Show ();
}
Private Void Log toolstripmenuitem_click ( Object Sender, eventargs E)
{
Foreach (Form In Application. openforms)
{
If (Form. Text = " Frmloginfo " )
{
Form. Activate ();
Return;
}
}
Frmloginfo log = New Frmloginfo ();
Log. mdiparent = This ;
Log. windowstate = Formwindowstate. maximized;
Log. Show ();
}
Private Void Frmmain_load ( Object Sender, eventargs E)
{< br> frmlogin login = New frmlogin ();
login. windowstate = formwindowstate. maximized;
login. mdiparent = This ;< br> login. show ();
}
}
}
The MDI form maximizes the size of the child form in the parent form. If the child form has already been opened, it is displayed and the form is not opened repeatedly. Of course, you can use the single-piece mode or the mutex Technology in multiple threads.