To add a group to the Ribbon tab, you can use the smart designer, collection editor, or add code. Each option is described below.
Complete the following steps:
Complete the following steps:
To add a RibbonGroup to the RibbonTab, add the following code to your project:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Imports C1.Win.C1Ribbon Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Add a tab to the Ribbon Dim RibbonTab2 As RibbonTab = New RibbonTab() ' Label the tab RibbonTab2.Text = "Write" C1Ribbon1.Tabs.Add(RibbonTab2) ' Add a group to the Write tab Dim RibbonGroup2 As RibbonGroup = New RibbonGroup() ' Label the group RibbonGroup2.Text = "Font" RibbonTab2.Groups.Add(RibbonGroup2) End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
// type the using directive for the namespace using C1.Win.C1Ribbon; private void Form1_Load(object sender, System.EventArgs e) { // Add a tab to the Ribbon RibbonTab RibbonTab2 = new RibbonTab(); // Label the tab RibbonTab2.Text = "Write"; c1Ribbon1.Tabs.Add(RibbonTab2); // Add a group to the Write tab RibbonGroup RibbonGroup2 = new RibbonGroup(); // Label the group RibbonGroup2.Text = "Font"; RibbonTab2.Groups.Add(RibbonGroup2); } |
Note: If your RibbonGroup.Text property is set to a value that is longer than the contents of the RibbonGroup, you can set the TrimLongCaption property to True to trim the caption to the same length as the RibbonGroup.