![]() When an MDI child form gets the focus, Visual Basic merges its menus with its parents. By default, the child's menus are added to the parent's. To make some of the child's menus replace some in the MDI container, set the menus' MergeType property to Replace. This example creates two menus, mainMenu1 and mainMenu2. When Visual Basic merges the menus, it replaces the MDI container's menus with MergeType = Replace with those in the child that have MergeType = Replace. The first menu contains one MenuItem, File, and the second contains one MenuItem, Edit. Using the MergeMenu method, mainMenu2 is merged with mainMenu1. When displayed, mainMenu1 will contain the two menu items, File and Edit. ![]() ![]() This example requires that you have created a Form named Form1. I am using VB.Net on Winforms Development developing an MDI application. Sometimes you may want to replace more than one menu with more than one other. In my child forms, I also have a menu strip attached to each form, which invokes a different set of command when accessed. For example, the MDI container and the child many both have Orders, Customers, and Tools menus. Set MergeType = Replace for all of the menus. ![]() Then to make the child menus replace the corresponding MDI container menus, set each pair's MergeOrder property to the same value. For example, set MergeOrder = 0 for both Orders menus, MergeOrder = 1 for both Customers menus, and MergeOrder = 2 for both Tools menus.
0 Comments
Leave a Reply. |