C # develop the winform interface framework,

Source: Internet
Author: User

C # develop the winform interface framework,

First, create a "Windows application". The default "Form1" file is changed to the form of MainForm as the main form of the program. Drag three widgets from the control box: MenuStrip, ToolStrip, and StatusStrip. You can modify the Dock attribute of ToolStrip to set the TOOL location, which is similar to fram's content. Set "IsMdiContainer" of MainForm to true, which means it can accommodate multiple Form objects.

Next we can create a batch of forms, each of which implements different functions. These Form "FormBorderStyle" must be set to None, so that the buttons to maximize and minimize will be hidden. In addition, set AutoSize to true to enable the Form to adapt the size of the main Form. Set "ShowInTaskbar" to false.

In the Load events of these child forms, add a function and write the following sentence:

This. Dock = DockStyle. Fill;

This is to fill the main form.

Next, add some buttons in the ToolStrip control of the main form, and then write the functions for clicking these buttons. In the function, you first need to generate the child Form instance, and then add a key sentence:

Form_child.MdiParent = this;

The Code indicates that MainForm contains the subform.

When you add multiple buttons in ToolStrip, You need to determine if the corresponding child Form has an instance when clicking the button. If yes, use form_child.Show () the child Form is displayed.

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.