ComponentOne Menus and Toolbars for WinForms
Menus and Toolbars Overview / Unique Objects Among Menus and Toolbars / MainMenu Control
In This Topic
    MainMenu Control
    In This Topic

    C1MainMenu is a control that displays the main menu in a Windows form. When you place this object on your form, it will show across the whole form at the top, as regular Windows main menus do. In addition to the main menu at the top of the form, a C1CommandHolder will automatically appear in the component tray. The C1CommandHolder stores all of the menu's commands as a single collection. Only one C1MainMenu control can be added to a form.

    To add the C1MainMenu control at design-time:

    In the Visual Studio Toolbox, double-click on the C1MainMenu component or drag and drop it onto the form.

    To add the C1MainMenu control programmatically:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Imports C1.Win.C1Command
    Dim ch As C1CommandHolder(Me)
    Dim mm As New C1MainMenu
    Me.Controls.Add(mm)
    

    To write code in C#

    C#
    Copy Code
    using C1.Win.C1Command
    C1CommandHolder.CreateCommandHolder(this);
    C1MainMenu mm = new C1MainMenu();
    this.Controls.Add(mm);
    

    The following screen shot depicts a C1MainMenu control once it’s been added to the form:

    C1MainMenu control


     

    The C1MainMenu control includes a Link to Command designer that conveniently allows you to visually configure the menus.

    Note: This editor is available for all C1CommandLinks; therefore, you can easily edit all command links for any of the objects: C1ContextMenu, C1ToolBar, and C1OutBar.

    For more information about the elements in the Link to Command designer see Link to Command Designer.

    For more information that shows how to use the C1MainMenu control for specific tasks, see Menu Tasks.

    See Also