If the following figure is displayed:
After maximization:
Move to cover the menu bar:
You should know that after C # has maximized the child form, the title bar of the child form will be integrated with the menu bar of the parent form. After the child form is minimized, a small form is docked next to the status bar:
Cause:
The following statement is added to private void form1_load (Object sender, eventargs E:
Child. toplevel = false; child. parent = This; // this phenomenon is caused by these two sentences: child. startposition = formstartposition. manual; child. show (); child. focus ();
Solution: change the code above:
Child. windowstate = formwindowstate. Normal; child. mdiparent = This; // you must write this code. Otherwise, an error occurs. Child. Show (); Child. Focus ();
If the following error occurs:
An exception occurs when "the top-level control cannot be assigned to the control" is reported.
child.TopLevel = false;
This Code, resulting in this phenomenon.
After solving these problems, the correct effect is:
If the following conditions occur:
Solution: add the itemadded event handler function of the menustrip1 control of the main form. The Code is as follows:
private void menuStrip1_ItemAdded(object sender, ToolStripItemEventArgs e) { if (e.Item.Text.Length == 0 ) { e.Item.Visible = false; } }