Design a multi-Document Interface (MDI) application to open, arrange, and close subwindows ., One multiple mdi
First, we need to know what is the multi-Document Interface (MDI)
In theory, it is "developed and designed in a multi-document window environment. This multi-document interface is called the multi-Document Interface (mdi )"
The most common Excel sheet is mdi.
[My personal understanding is like this]
Start the actual operation:
1. Open two forms. Form2 is the main form and Form2_son is the subform]
2. Drag the control in the main form Form2
MenuStrip (menu bar)
Set IsMdiContainer = True for form2
3. Drag the control in the subform Form2_son.
RichTextBox (full window duck attribute)
4. Code in Form2
Private void open the subwindow ToolStripMenuItem_Click (object sender, EventArgs e) {Form2_son myChild = new Form2_son (); myChild. MdiParent = this; myChild. Show ();}
1 // Close the subform of the current activity 2 private void Close the subwindow ToolStripMenuItem_Click (object sender, EventArgs e) 3 {4 ActiveMdiChild. Close (); 5}
Private void close all subwindows ToolStripMenuItem_Click (object sender, EventArgs e) {if (MdiChildren. length> 0) {foreach (Form myForm in mdichil.pdf) {myForm. close ();}}}
// Exit the program
Private void Exit ToolStripMenuItem_Click (object sender, EventArgs e) {Application. Exit ();}
// The form is arranged by LayoutMdi () where the parameter is the enumerated Value
MdiLayout. Cascade // Cascade
MdiLayout. TileHorizontal // horizontal Tile
MdiLayout. TileVertical // vertically tiled
Private void stacked ToolStripMenuItem_Click (object sender, EventArgs e) {this. layoutMdi (MdiLayout. cascade);} private void horizontally tiled ToolStripMenuItem_Click (object sender, EventArgs e) {this. layoutMdi (MdiLayout. tileHorizontal );}