MDI父菜单和子菜单

时间:2021-10-26 21:35:10

I am using VB.Net on Winforms Development developing an MDI application.

我在Winforms Development上使用VB.Net开发MDI应用程序。

In my Parent form, I have a menu strip. In my child forms, I also have a menu strip attached to each form, which invokes a different set of command when accessed. Is it possible then that in an MDI form, the child form which is currently active be the menu that would display in the parent form?

在我的父表单中,我有一个菜单条。在我的子表单中,我还有一个附加到每个表单的菜单条,它在访问时调用一组不同的命令。那么在MDI表单中,当前活动的子表单是否可以显示在父表单中的菜单?

1 个解决方案

#1


2  

It's easy. Just add a MenuStrip to the parent but leave it empty. The built-in support for menu merging ensures that the active child's menu appears in the empty parent strip.

这很简单。只需将MenuStrip添加到父级即可,但请将其留空。对菜单合并的内置支持可确保活动子菜单显示在空父条带中。

#1


2  

It's easy. Just add a MenuStrip to the parent but leave it empty. The built-in support for menu merging ensures that the active child's menu appears in the empty parent strip.

这很简单。只需将MenuStrip添加到父级即可,但请将其留空。对菜单合并的内置支持可确保活动子菜单显示在空父条带中。