System.Windows.Forms.MainMenu Class

Represents the menu structure of a form. Although System.Windows.Forms.MenuStrip replaces and adds functionality to the System.Windows.Forms.MainMenu control of previous versions, System.Windows.Forms.MainMenu is retained for both backward compatibility and future use if you choose.

See Also: MainMenu Members


[System.ComponentModel.ToolboxItemFilter("System.Windows.Forms.MainMenu", System.ComponentModel.ToolboxItemFilterType.Allow)]
public class MainMenu : Menu


The System.Windows.Forms.MainMenu control represents the container for the menu structure of a form. A menu is composed of System.Windows.Forms.MenuItem objects that represent the individual menu commands in the menu structure. Each System.Windows.Forms.MenuItem can be a command for your application or a parent menu for other submenu items. To bind the System.Windows.Forms.MainMenu to the System.Windows.Forms.Form that will display it, assign the System.Windows.Forms.MainMenu to the Form.Menu property of the System.Windows.Forms.Form.

For applications that will have support for multiple languages, you can use the MainMenu.RightToLeft property to display the text of the menu from right to left to support languages such as Arabic.

You can create different System.Windows.Forms.MainMenu objects to represent different menu structures for your form. If you want to reuse the menu structure contained in a specific System.Windows.Forms.MainMenu, you can use its MainMenu.CloneMenu method to create a copy. Once you have a copy of the menu structure, you can make the appropriate modifications for your new menu structure.


Cutting and pasting menu items from one form to another in the designer might not work as expected if the form you are pasting into has no menu items defined.


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