Winform Information Management System, winform
Effect:
Explanation:
The main window is an MDI window with subwindows. The Child Window controls include tree structure treeview, panel control, listview control (this is a window listview), and butten control.
Function:
Click "Employee management" panel in the tree structure to display listview data.
Other functions are not yet written ......
Main Window Form1
Form attributes:
IsMdiContainer = true;
[The window can only have one parent window, and the Child Window cannot be changed to the parent window (nesting not allowed) by setting IsMdiContainer = true )]
Background code:
1 2 3 4 private void Form1_Load (object sender, EventArgs e) 5 {
6 Form1_son son = new Form1_son (); // subwindow object
7 son. Text = "Information Management System Maintenance Information Feedback ";
8 son. MdiParent = this; // note
9 son. Dock = DockStyle. Fill; // maximize the sub-window (overlay the main window)
10
11 son. Show (); // The subwindow is displayed in the main window.
12
13 // son. WindowState = FormWindowState. Maximized;
14
15
}
Child form: Form1_son
Background code:
1 Form1_son_panel fpanel = new Form1_son_panel (); // Sun Tzu window object 2 3 4 private void treeView1_AfterSelect (object sender, TreeViewEventArgs e) 5 {
// You can also use swith () 6 if (treeView1.SelectedNode. text = "Employee management") 7 {8 fpanel. topLevel = false; // Make Sun Tzu's window not a top-level window, so that window 9 fpanel can be embedded. formBorderStyle = FormBorderStyle. none; // remove the border 10 this from the Sun Tzu window. panel1.Controls. add (fpanel); // Add the grandson window 11 fpanel in the panel control. show (); // display in the subwindow of the grandson (this sentence is not displayed) 12}
}
Explanation:
TopLevel attribute [true/false]
IfTrue, The form is displayed as a top-level window; otherwiseFalse. The default value isTrue. Top-level window: no parent window or primary window]
Sun Tzu form: Form1_son_panel
Sun Tzu attributes: FormBorderStyle = None [retain content only, remove borders, etc]
Background code:
1 public static Form1_son_panel fpanel; // 2 3 public Form1_son_panel () 4 {5 InitializeComponent (); 6 7 fpanel = this; // Note 8}