You can add a menu item to C1MainMenu at design time by adding the C1MainMenu component and then appending menu items to it using the Edit designer (Menu designer). Menus can also be added programmatically by adding C1CommandHolder object to the Windows form to hold the menus, add the C1MainMenu object, and then create the command type for the menu. This topic shows how to create a menu item, called menu 1 that can hold future submenu items.
To add a menu item to C1MainMenu at design time
To add a menu item to C1MainMenu using the Link to Command designer, complete the following:
To add a menu item to C1MainMenu programmatically
To add the menu item to C1MainMenu programmatically, complete the following steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Imports C1.Win.C1Command Dim ch As C1CommandHolder = C1CommandHolder.CreateCommandHolder(Me) |
To write code in C#
C# |
Copy Code
|
---|---|
using C1.Win.C1Command; C1CommandHolder ch = C1CommandHolder.CreateCommandHolder(this); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim mm As New C1MainMenu Me.Controls.Add(mm) |
To write code in C#
C# |
Copy Code
|
---|---|
C1MainMenu mm = new C1MainMenu(); this.Controls.Add(mm); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim mmenu As C1CommandMenu = CType(ch.CreateCommand(GetType(C1CommandMenu)), C1CommandMenu) mmenu.Text = "&menu1" |
To write code in C#
C# |
Copy Code
|
---|---|
C1CommandMenu mmenu = ch.CreateCommand(typeof(C1CommandMenu)) as C1CommandMenu; mmenu.Text = "&menu1"; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
mm.CommandLinks.Add(New C1CommandLink(mmenu)) |
To write code in C#
C# |
Copy Code
|
---|---|
mm.CommandLinks.Add(new C1CommandLink(mmenu)); |