How can I merge menu items of parent form and child form with same menu name?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Set the MergeAction of the menu items to "MatchOnly".
Added
Because this can get a little tricky, I'll add a list of steps to make a simple example.
new Form2 { MdiParent = this }.Show();
to the handler method.Notice that the File menu items are A and B.
Click File -> A to create a child window.
Notice that the File menu on the container now contains A, B, and C.
Notice also that the File menu on the child is there, but has no items. This is because C was merged.
You can now set the child's MenuStrip.Visible property to False so that the child does not display a menu. It is handy to leave this as True when designing your menus so that you can verify that all the child menu items have been merged correctly (they will be gone from the child menu).
You can use the MergeIndex property to control how child items get merged into the container.