C # Multiple forms and Menu toolbars

Source: Internet
Author: User

Multiple forms:

1. Which is the main form

Problem: The main form is hidden, after closing other forms, the main form is not displayed/closed, then the program is closed

(1), the value of the constructor, the form is passed to another form

2. The form can only open one

Creates a global generic collection in order to place all open forms

(1), before the form opens, determine whether there is a name consistent form in the collection, if there is a description is open, do not open the

Issue: When the form is open and closed, it cannot be opened again

Workaround: Clears this form object record from 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

Workaround: Locate the Open object, set the WindowState property to: Find the object for the open form, and use the focus method;

3. Transfer values and controls between forms

Pass value: Constructor pass value

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 rights of objects in the form

4. The form of the prompt box type

ShowDialog ();

Role:

Menus and toolbars:

1, MenuStrip: Top menu Split Line: 1,-2, right-click Insert Split ...

Shortcut keys: The bottom of the right-click property for each item you can set the shortcut key to 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 strip container

C # Multiple forms and Menu toolbars

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.