简体   繁体   English

将MDI子项中的菜单项合并到容器的菜单中

[英]Merge menu items from MDI child into container's menu

I have exactly followed the steps described in Merge menu strip items for MDI windows to create a test application with an MDI container and an MDI child with a File menu. 我完全按照MDI窗口的合并菜单带项目中描述的步骤来创建带有MDI容器和带有File菜单的MDI子的测试应用程序。 I have tried this in Visual Studio 2013 for every .NET framework from 2.0 to 4.5, and also tried in Visual Studio 2012. The result is the same. 我已经在Visual Studio 2013中针对从2.0到4.5的每个.NET框架进行了尝试,并且还在Visual Studio 2012中进行了尝试。结果是相同的。 The menus do not merge. 菜单不合并。 All I get is this: 我所得到的是这样的:

在此处输入图片说明

The two file menus are supposed to be one, or at least both be in the menu bar. 这两个文件菜单应该是一个,或者至少两个都在菜单栏中。 What's going on? 这是怎么回事? How is one supposed to get these menus to automatically merge? 如何使这些菜单自动合并?

In your Form2 constructor, set the visibility of the MenuStrip control to false: 在您的Form2构造函数中,将MenuStrip控件的可见性设置为false:

public Form2() {
  InitializeComponent();
  menuStrip1.Visible = false;
}

The "C" menu should be visible on the main form's File menu. “ C”菜单应该在主窗体的“文件”菜单上可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM