The MDI form. The child form maximizes the size of the child form in the parent form. If the child form has been opened, the child form is displayed.

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.