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# |
コードのコピー
|
---|---|
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# |
コードのコピー
|
---|---|
C1Ribbon customRibbon = new C1Ribbon(); this.Controls.Add(customRibbon); |
C# |
コードのコピー
|
---|---|
///ホームタブを追加します。 RibbonTab homeTab = new RibbonTab(); homeTab.Text = "Home"; customRibbon.Tabs.Add(homeTab); ///挿入タブを追加します。 RibbonTab insertTab = new RibbonTab(); insertTab.Text = "Insert"; customRibbon.Tabs.Add(insertTab); |
C# |
コードのコピー
|
---|---|
///「Font」という名前のグループを「ホーム」タブに追加します RibbonGroup fontGroup = new RibbonGroup(); fontGroup.Text = "Font"; homeTab.Groups.Add(fontGroup); ///「Color」という名前のグループを「ホーム」タブに追加します RibbonGroup colorGroup = new RibbonGroup(); colorGroup.Text = "Color"; homeTab.Groups.Add(colorGroup); |
C# |
コードのコピー
|
---|---|
///「ホーム」タブのフォントグループに項目フォントピッカーを追加します RibbonFontComboBox fontComboBox = new RibbonFontComboBox(); fontComboBox.Text = "Select a Font"; fontGroup.Items.Add(fontComboBox); ///項目カラーピッカーをホームタブのカラーグループに追加します RibbonColorPicker colorPicker = new RibbonColorPicker(); colorGroup.Items.Add(colorPicker); //Colorpicker コントロールの横に表示するアイコンセットを定義します 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# |
コードのコピー
|
---|---|
partial class Form1 : C1RibbonForm { //... } |