C # Write a few sections of WinForm MDI form control code sharing

Source: Internet
Author: User

  

        /// <summary>        ///function: Set the main form size to the display workspace size in the MDI program/// </summary>        /// <param name= "mainform" >main form Instance</param>         Public Static voidsetmainformsize (Form mainform) {mainform.location=NewPoint (0,0); Mainform.width=Screen.PrimaryScreen.WorkingArea.Width; Mainform.height=Screen.PrimaryScreen.WorkingArea.Height; }

*****************************************************

        /// <summary>        ///function: Child form size in MDI program is parent form workspace size/// </summary>        /// <param name= "MDIForm" >child Form Instance</param>         Public Static voidsetmdichildsize (Form mdiform) {mdiform.location=NewPoint (0,0); Mdiform.width=MdiForm.Parent.ClientSize.Width; Mdiform.height=MdiForm.Parent.ClientSize.Height; }

*****************************************************

        /// <summary>        ///function: Close all open MDI child forms/// </summary>        /// <param name= "mainform" >parameters: Parent Form</param>         Public Static voidcloseallmdiforms (Form mainform) {if(MainForm.MdiChildren.Length <=0)            {                return; }            Else            {                foreach(Form SubforminchMainform.mdichildren) {subform.close (); }            }        }

*****************************************************

        /// <summary>        ///function: Detects MDI child form state changes, restores default state when a subform is minimized or maximized/// </summary>        /// <param name= "MDIForm" >child Form Instance</param>         Public Static voidsetmdiformstate (Form mdiform) {if(MDIForm = =NULL)            {                return; }            Else if((mdiform.windowstate = = formwindowstate.minimized) | | (mdiform.windowstate==formwindowstate.maximized)) {mdiform.windowstate=Formwindowstate.normal; }        }

C # Write a few sections of WinForm MDI form control code sharing

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.