这个在产品的开发包中的演示程序项目里有详细的代码,基本的方式如下
- // Create a new instance of C1Ribbon and add it to the form.
- C1Ribbon c1Ribbon1 = new C1Ribbon();
- this.Controls.Add(c1Ribbon1);
- // Add the Home tab and the Font group.
- RibbonTab homeTab = c1Ribbon1.Tabs.Add("Home");
- RibbonGroup fontGroup = homeTab.Groups.Add("Font");
- // Add a toolbar to arrange the buttons in a row.
- RibbonToolBar toolBar1 = new RibbonToolBar();
- fontGroup.Items.Add(toolBar1);
- // Add the Bold, Italic, and Strike Through buttons.
- toolBar1.Items.Add(new RibbonToggleButton(Properties.Resources.Bold));
- toolBar1.Items.Add(new RibbonToggleButton(Properties.Resources.Italic));
- toolBar1.Items.Add(new RibbonToggleButton(Properties.Resources.Strikethrough));
复制代码 |