. NET Learning 3rd season WinForm application MDI Form Design MenuStrip

Source: Internet
Author: User

Forms 2, 3, 4 ... a design that falls only within the scope of form 1 (the parent form) and can be displayed all---MDI form design

Create an object of the MenuStrip class in Form 1 (menu bar), set one of the click events to show Forms 2, 3, 4

Private void Display Subform Toolstripmenuitem_click (object  sender, EventArgs e)            {new Form2 ();            F2. Show ();             New Form3 ();            F3. Show ();             New Form4 ();            F4. Show ();        }

This is done just to show forms 2, 3, 4, and they are not limited to the range shown in Form 1.

Form 1 is defined first as a parent form, and the Form1 property IsMdiContainer is set to true. Then set the Form2, 3, 4 property mdiparent to Form1. The display of Forms 2, 3, and 4 is limited to the scope of form 1.

 private  void  Show Subform Toolstripmenuitem_click (object   sender, EventArgs e) {Form2 F2  = new              Form2 (); F2.            MdiParent  = this  ; F2.            Show ();            Form3 f3  =  FORM3 (); F3.            MdiParent  = this  ; F3.            Show ();            FORM4 f4  =  FORM4 (); F4.            MdiParent  = this  ; F4.        Show (); }

Because this method is in class Form1, this is referring to the Form1 we want.

The MDI form has a method LayoutMDI () that controls how the subform is arranged, and the parameter is an enumeration type of mdilayout.

Private void transverse arrangement toolstripmenuitem_click (object  sender, EventArgs e)        {            LayoutMDI ( mdilayout.tilehorizontal);        } Private void longitudinal arrangement toolstripmenuitem_click (object  sender, EventArgs e)        {            LayoutMDI ( mdilayout.tilevertical);        }

. NET Learning 3rd season WinForm application MDI Form Design MenuStrip

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.