Menu.CloneMenu Method (Menu)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Copies the Menu that is passed as a parameter to the current Menu.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member CloneMenu : 
        menuSrc:Menu -> unit


Type: System.Windows.Forms.Menu

The Menu to copy.

This method copies the entire list of MenuItem objects (stored in the Menu passed in to menuSrc) into the current menu. You can use this method in your derived class to clone MenuItem objects. They can then be reused by other classes that derive from Menu, such as MainMenu, ContextMenu, and MenuItem.

This example creates a main menu, mainMenu1, with three menu items: File, Edit, and View. It then uses the CloneMenu method to copy mainMenu1 into mainMenu2. The cloned menu is then assigned to the form and displayed. This program requires that you have already created a Form named Form1.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top