TX Text Control X14 (24.0) comes with a fully-customizable, programmable Ribbon control. Pre-configured RibbonTabs can be used to create typical TX Text Control applications without writing a single line of code.

This article shows how to customize the Ribbon control. A new RibbonTab is inserted that contains a custom RibbonGroup with a RibbonButton that executes a command when clicked.

  • Drag and drop a new instance of the Ribbon control from the toolbox to a new form in a Windows Forms project:

    Customizing the Text Control Ribbon control
  • Click on the blue File RibbonTab title to select the created control and find the SmartTag in the upper right corner. Click on the SmartTag to open the Ribbon Tasks list and choose Add a Quick Access Toolbar.

    Customizing the Text Control Ribbon control

This will change the form inheritance to RibbonForm which adds ribbon features to the form such as the Quick Access Toolbar and the centered form title.

Now, in the Form Load event, you can customize the ribbon by adding tabs and groups. The following code creates and inserts a new RibbonTab:

// create a new RibbonTab
RibbonTab rtMyRibbonTab = new RibbonTab();
rtMyRibbonTab.Text = "My RibbonTab";
view raw test.cs hosted with ❤ by GitHub

In the following code, a new RibbonButton is created and a Click event is attached. The RibbonItem is then added to a newly created HorizontalRibbonGroup.

// create a new RibbonItem
RibbonButton rbMyButton = new RibbonButton()
Text = "My RibbonButton",
LargeIcon = Image.FromFile("icons/clipboard.png"),
SmallIcon = Image.FromFile("icons/checkmark.png")
// attach Click event
rbMyButton.Click += RbMyButton_Click;
// create a new RibbonGroup
HorizontalRibbonGroup rgMyRibbonGroup = new HorizontalRibbonGroup()
Text = "My RibbonGroup",
ShowSeperator = false,
SmallIcon = Image.FromFile("icons/checkmark.png"),
LargeIcon = Image.FromFile("icons/clipboard.png"),
// add the RibbonItem to the RibbonGroup
view raw test.cs hosted with ❤ by GitHub

Finally, the new RibbonGroup is added to the RibbonTab:

// add the RibbonGroup to the RibbonTab
view raw test.cs hosted with ❤ by GitHub

The following screenshot shows the newly created RibbonTab and it's elements:

Customizing the Text Control Ribbon control

Try this on your own and download the trial version of TX Text Control .NET for Windows Forms X14.