How to solve the problem of merging the title bar of the child form and the menu bar of the main form by maximizing the child form of WinForm MDi, winformmdi

Source: Internet
Author: User

How to solve the problem of merging the title bar of the child form and the menu bar of the main form by maximizing the child form of WinForm MDi, winformmdi

Write the following code in the ItemAdded event in the main form menu bar:

* MsMain is the Name attribute value in the menu bar of my main form.

// The private void msMain_ItemAdded (object sender, ToolStripItemEventArgs e) {if (e. item. text. length = 0) {e. item. visible = false;} else {e. item. visible = true ;}}

 

Note:

When the child form is maximized, the icon of the child form is no longer displayed on the left of the menu bar, and only the button on the right is retained.

If you only want to retain the close button, you only need to modify the code to the following:

  

// Remove the private void msMain_ItemAdded (object sender, ToolStripItemEventArgs e) when the sub-form is maximized {// if you do not need to close the button, you only need to add the code in parentheses after this if: | e. item. text = "close (& C)
If (e. item. text. length = 0 | e. item. text = "Restore (& R)" | e. item. text = "minimal (& N)") {e. item. visible = false;
}
Else
{
E. Item. Visible = true;
}}

 

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.