The following quick-start guide takes you through steps to add the Ribbon control to the application through designer and code.
This section demonstrates creating a simple WinForms App to add Ribbon control that includes Tabs, Groups and few controls, as shown in the below image:
You can also add other items from the group item list to this group as per your requirement.
Run the application and observe the output.
Optionally, you can also convert a Windows Form to a Ribbon Form by following these steps.
C# |
Copy Code
|
---|---|
partial class Form1 : C1RibbonForm { //... } |
This section demonstrates creating a simple WinForms App to add Ribbon control that includes Tabs, Groups and a few controls through code, as shown in the below image.
Complete the following steps to add Ribbon control to the Windows Form:
C# |
Copy Code
|
---|---|
C1Ribbon customRibbon = new C1Ribbon(); this.Controls.Add(customRibbon); |
C# |
Copy Code
|
---|---|
///Adding home tab. RibbonTab homeTab = new RibbonTab(); homeTab.Text = "Home"; customRibbon.Tabs.Add(homeTab); ///Adding insert tab. RibbonTab insertTab = new RibbonTab(); insertTab.Text = "Insert"; customRibbon.Tabs.Add(insertTab); |
C# |
Copy Code
|
---|---|
///Adding group named "Font" to the "Home" tab RibbonGroup fontGroup = new RibbonGroup(); fontGroup.Text = "Font"; homeTab.Groups.Add(fontGroup); ///Adding group named "Color" to the "Home" tab RibbonGroup colorGroup = new RibbonGroup(); colorGroup.Text = "Color"; homeTab.Groups.Add(colorGroup); |
C# |
Copy Code
|
---|---|
///Add item fontpicker to fontgroup in Home tab RibbonFontComboBox fontComboBox = new RibbonFontComboBox(); fontComboBox.Text = "Select a Font"; fontGroup.Items.Add(fontComboBox); ///Add item colorpicker to color group in Home tab RibbonColorPicker colorPicker = new RibbonColorPicker(); colorGroup.Items.Add(colorPicker); //Define the iconset to display next to Colorpicker control colorPicker.IconSet.Add(new C1BitmapIcon(null, new Size(20, 20), Color.Transparent, Image.FromFile(@"images\fontcolor.png"))); |
Run the application and observe the output.
Optionally, you can convert a Windows Form to a Ribbon Form by following the below steps.
C# |
Copy Code
|
---|---|
partial class Form1 : C1RibbonForm { //... } |