MDI Form container
The Multiple Document interface (Multiple-document Interface) is abbreviated as an MDI form. MDI forms are used to display multiple documents at the same time, and each document appears in its own window. MDI forms typically have a window menu with submenus that you use to toggle between windows or documents.
(1) First, you set the main form as a container for an MDI form, because only then can you add an MDI form on top of the main form, which allows you to program the MDI, specifically implementing the following statement:
1 This true ;
(2) Create a new MDI form above the main form. In the program, the command to create a new MDI form is implemented through a menu of events. In processing a new MDI form event, the key is to set the parent form of this MDI form. In fact, MDI forms and other forms are not different, the difference is that the MDI form has a first-level form, that is, the parent form, and the other forms are not, the implementation statement is as follows:
Form frmtemp = new Form (); // Create a new form frmtemp.mdiparent = Span style= "color: #0000ff;" >this ; // Defines the parent form of this form so that the form becomes an MDI form Frmtemp.text = form 0 " + formcount.tostring (); // Set the title of the MDI form Formcount++ ; Frmtemp.show (); // show this MDI form
(3) Implementing a cascade of MDI forms:
For the implementation of the main form of the MDI form Cascade operation, in the main program, is implemented by a method, this method is LayoutMDI, he takes the parameters are mdilayout.cascade, the implementation of the statement as follows:
This . LayoutMDI (Mdilayout.cascade);
After implementing the operation, as follows:
(4) To implement horizontal tiling of MDI forms:
To implement a horizontal tiling of the MDI form in the main form, it is also through the LayoutMDI method, at which time the parameter is mdilayout.tilehorizontal, the implementation statement is as follows:
this. LayoutMDI (mdilayout.tilehorizontal);
After implementing the operation, as follows:
(5) To implement a vertical tile to an MDI form:
To implement the MDI form in the main form to tile vertically, also through the LayoutMDI method, at this time the parameters are mdilayout.tilevertical, the implementation of the statement as follows:
this. LayoutMDI (mdilayout.tilevertical);
After implementing the operation, as follows:
(6) In some MDI programs, when a new MDI form is created, a submenu item with the name of this MDI form is produced below the menu item. Only add the following sentence to the main menu item you want to add:
true ;
Design Interface Setup Method:
The program run interface is as follows:
MDI Form Container--December 15, 2016