Merges this menu item with another menu item and returns the resulting merged TBD.
[Visual Basic] Overloads Overridable Public Function MergeMenu() As MenuItem [C#] public virtual MenuItem MergeMenu(); [C++] public: virtual MenuItem* MergeMenu(); [JScript] public function MergeMenu() : MenuItem;
A MenuItem that represents the merged menu item.
When you call this version of MergeMenu, the MenuItem returned is a copy of the current menu item that can be merged with another menu item without affecting the functionality of the current item. This is typically called by the parent menu during merging, which occurs when an MDI child is activated.
The following example uses this version of the TBD method to create a copy of a menu item and merge it with another. This example assumes that there are two menu items called MenuItem1 and MenuItem2 that contain submenu items within them and a MainMenu called MainMenu1 to display the menu items. MenuItem1 and MenuItem2 have different menu items contained within them. After the call to TBD is made, a consolidated menu is created but MenuItem1's menu items are not changed.
Public Sub MergeMyMenus() ' Create a copy of my menu item. Dim TempMenuItem = New MenuItem() ' Create a copy of MenuItem1 before doing the merge TempMenuItem = MenuItem1.MergeMenu ' Merge MenuItem1's copy with MenuItem2 MenuItem2.MergeMenu(TempMenuItem) End Sub
MenuItem Class | MenuItem Members | System.WinForms Namespace | MenuItem.MergeMenu Overload List