System.Windows.Forms.Menu.MergeMenu Method

Merges the System.Windows.Forms.MenuItem objects of one menu with the current menu.

Syntax

public virtual void MergeMenu (Menu menuSrc)

Parameters

menuSrc
The System.Windows.Forms.Menu whose menu items are merged with the menu items of the current menu.

Remarks

This method merges System.Windows.Forms.MenuItem objects from one menu with the current menu. System.Windows.Forms.MenuItem objects are merged according to the values of the MenuItem.MergeType and MenuItem.MergeOrder properties.

Menu merging is typically done to merge the menus of a Multiple Document Interface (MDI) parent form with those of its active MDI child form. This is performed automatically by the .NET Framework common language runtime. For example, if an MDI parent form contains a set of menus for handling files and your MDI child form also has file-related menu items, the menu sets will automatically merge into a single file menu set when the child form is displayed in the MDI parent form.

You can use the Menu.MergeMenu(Menu) method if you are merging two menu structures that are not part of an MDI application. This implementation can be called by the System.Windows.Forms.MainMenu or System.Windows.Forms.ContextMenu classes to merge two or more objects that derive from System.Windows.Forms.Menu.

To merge two System.Windows.Forms.MenuItem objects use the MenuItem.MergeMenu method.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0