The RibbonTab class represents a tab in a Ribbon. A RibbonTab can be used to organize related groups of commands in a Ribbon. The RibbonTab hosts one or more RibbonGroup instances and is the base class of predefined tabs such as the RibbonFormattingTab, RibbonInsertTab, RibbonPageLayoutTab, RibbonViewTab, RibbonProofingTab, RibbonReportingTab, RibbonTableLayoutTab, RibbonFormulaTab, RibbonFrameLayoutTab, RibbonChartLayoutTab, RibbonPermissionsTab and RibbonFormFieldsTab. A RibbonGroup then hosts controls that represent application commands. A RibbonTab is inherited from the System.Windows.Forms.TabPage class. The following describes only the properties, methods and events defined through the RibbonTab class. For a list of properties, methods and events inherited from the System.Windows.Forms.TabPage class see the .NET Framework reference.

Syntax

public class RibbonTab : System.Windows.Forms.TabPage
Public Class RibbonTab
  Inherits System.Windows.Forms.TabPage

Introduced: X14.

Examples

The following code creates a complete new Windows.Forms.Ribbon.RibbonTab with a new Windows.Forms.Ribbon.RibbonGroup. Additionally, a new Windows.Forms.Ribbon.RibbonButton is created and added to the created ribbon group. Finally, the ribbon tab is added to the Controls collection of the ribbon control and the selected tab is specified using the SelectedIndex property.

// 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;

Constructors

Constructor Description
RibbonTab Initializes a new instance of the RibbonTab class.

Properties

Property Description
KeyTip Gets or sets the keyboard shortcut of the RibbonTab.
RibbonGroups Gets a collection of all RibbonGroups in a RibbonTab.