Today, I first learned about the WinForm program development often encountered problems-multi-form program running problems.
When developing a multi-form program, you often encounter the following four issues:
First, which is the main form
Problem: The main form is hidden, and after closing other forms, the main form is not displayed/closed, then the program is closed.
When this problem is encountered, our usual workaround is to pass the value of the constructor, and then transfer the form to another form to close it.
Second, the form can only open a
Creates a global generic collection in order to place all open forms. Before the form opens, determine if there is a name-consistent form in the collection, and if it is already open, do not open it again.
Issue: When the form is open, it cannot be opened again after it has been closed.
The usual workaround for this problem is to clear the Form object record in the collection in Form1 when the form is closed.
Issue: When the form is already open, clicking the Open button again will not re-display the open form and focus into.
The solution to this problem is to find the open object, set the WindowState property to: Formwindowstate.normal; Find the object that has the open form, and use the focus method.
Third, the transfer of value and control between the form
Pass value: The value of the constructor.
Control: The first step, locate the Form object, and the second step, change the control value of the Form object.
Note: To modify the access permissions for objects in the form.
Iv. form of the type of the prompt box
ShowDialog ();
It does this by popping up a form that has to enter the contents of this form before it can continue with other forms.
Next, I learned the contents of menus and toolbars.
1, MenuStrip:
Top Menu
Split Line: 1,-2, right-click to insert Split ...
Shortcut keys: Each item right-click the bottom of the property to set shortcut keys
Shortcut keys work regardless of whether the option is hidden or the menu is hidden
2, ContextMenuStrip:
Right-click menu
3, Statusstript:
Bottom Menu
4, ToolStrip
Tool bar
5, ToolStripContainer
Tool Bar Container
WinForm multiple forms, menus, and toolbars