By default, the Application menu is empty, and you can add as many or as few items to the menu to fit your needs. The following steps demonstrate how to customize the main application button's drop-down menu.
Complete the following steps:
To create a Start menu of commands, add the following code to your project:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Include the Imports directive for the namespace Imports C1.Win.C1Ribbon Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Create the items for the left pane Dim NewButton As RibbonButton = New RibbonButton() Dim OpenButton As RibbonButton = New RibbonButton() Dim SaveButton As RibbonButton = New RibbonButton() ' Add items to the left pane menu Me.C1Ribbon1.ApplicationMenu.LeftPane.Items.Add(NewButton) Me.C1Ribbon1.ApplicationMenu.LeftPane.Items.Add(OpenButton) Me.C1Ribbon1.ApplicationMenu.LeftPane.Items.Add(SaveButton) ' Set properties for the left pane items NewButton.Text = "&New" NewButton.LargeImage = My.Resources.Resources.NewBtn OpenButton.Text = "&Open" OpenButton.LargeImage = My.Resources.Resources.OpenBtn SaveButton.Text = "&Save" SaveButton.LargeImage = My.Resources.Resources.SaveBtn End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
// Include the using directive for the namespace using C1.Win.C1Ribbon; private void Form1_Load(object sender, System.EventArgs e) { // Create the items for the left pane RibbonButton NewButton = new RibbonButton(); RibbonButton OpenButton = new RibbonButton(); RibbonButton SaveButton = new RibbonButton(); // Add items to the left pane menu this.c1Ribbon1.ApplicationMenu.LeftPane.Items.Add(NewButton); this.c1Ribbon1.ApplicationMenu.LeftPane.Items.Add(OpenButton); this.c1Ribbon1.ApplicationMenu.LeftPane.Items.Add(SaveButton); // Set properties for the left pane items NewButton.Text = "&New"; NewButton.LargeImage = Properties.Resources.NewBtn; OpenButton.Text = "&Open"; OpenButton.LargeImage = Properties.Resources.OpenBtn; SaveButton.Text = "&Save"; SaveButton.LargeImage = Properties.Resources.SaveBtn; } |
Run the application and click the main application button to reveal the drop-down menu of commands: