The Ribbon
public class RibbonTab : System.Windows.Forms.TabPage
Public Class RibbonTab
Inherits System.Windows.Forms.TabPage
Introduced: X14.
The following code creates a complete new Windows.
// create a new RibbonTab control and set the text (tab title)
RibbonTab myRibbonTab = new RibbonTab();
myRibbonTab.Text = "MyRibbonTab";
// create a new RibbonGroup
RibbonGroup myRibbonGroup = new RibbonGroup() { Text = "My Group" };
// make the dialog launcher icon invisible
myRibbonGroup.DialogBoxLauncher.Visible = false;
// add the new RibbonGroup to the RibbonGroup collection
// of the newly created RibbonTab
myRibbonTab.RibbonGroups.Add(myRibbonGroup);
// create a new RibbonButton
RibbonButton rbtnClickMe = new RibbonButton()
{
Text = "Click me!",
IsAddToQuickAccessToolbarEnabled = true,
};
// set some properties of the button and attach a "Click" event
rbtnClickMe.ToolTip.Title = "Tooltip Title";
rbtnClickMe.ToolTip.Description = "Tooltip Description";
rbtnClickMe.DisplayMode = IconTextRelation.LargeIconLabeled;
rbtnClickMe.LargeIcon = Image.FromFile("previewclose.png");
rbtnClickMe.Click += RbtnClickMe_Click;
rbtnClickMe.BackColor = Color.LawnGreen;
// add the button to the RibbonGroup
myRibbonGroup.RibbonItems.Add(rbtnClickMe);
// add the newly created RibbonTab to the Ribbon control
ribbon1.Controls.Add(myRibbonTab);
// set the selected tab to the new RibbonTab
ribbon1.SelectedIndex = ribbon1.TabCount - 1;
Constructor | Description |
---|---|
Ribbon |
Initializes a new instance of the Ribbon |
Property | Description |
---|---|
Key |
Gets or sets the keyboard shortcut of the Ribbon |
Ribbon |
Gets a collection of all Ribbon |