TX Text Control .NET for Windows Forms

SetQuickAccessToolbarStandardItems Method

Method|Introduced in 24.0
Namespace
TXTextControl.Windows.Forms.Ribbon
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.Windows.Forms.dll from the private NuGet feed or Text Control Offline Packages

Description

Specifies the standard items of the Quick Access Toolbar. Additional items can be added and removed through a context menu.

Syntax

public void SetQuickAccessToolbarStandardItems(RibbonButton[] items);

Parameters

ParameterDescription
items

An array of ToolStripItem objects which act as the standard items of the Quick Access Toolbar.

Examples

The following example defines 6 buttons as Quick Access Toolbar standard items:

private string[] strQATImages = {"save.png", "open.png", "newpage.png", "undo.png", "redo.png", "print.png" };
int iButtons = strQATImages.Length;
ToolStripButton[] buttons = new ToolStripButton[iButtons];
for (int i=0; i<iButtons; i++) 
{
    buttons[i] = new ToolStripButton();
    buttons[i].Image = new Bitmap(typeof(RibbonApp), strQATImages[i]);
    switch (i)
    {
        case 0: buttons[i].Click += OnSaveFile; break;
        case 1: buttons[i].Click += OnOpenFile; break;
        case 2: buttons[i].Click += OnNewDocument; break;
        case 3: buttons[i].Click += OnUndo; break;
        case 4: buttons[i].Click += OnRedo; break;
        case 5: buttons[i].Click += OnPrint; break;
    }
}
SetQuickAccessToolbarStandardItems(buttons);

The following example uses Set Quick Access Toolbar Standard Items in a focused Ribbon Form workflow. The created object is then available to the surrounding document workflow.

ribbonForm.SetQuickAccessToolbarStandardItems(new TXTextControl.Windows.Forms.Ribbon.RibbonButton[] { new TXTextControl.Windows.Forms.Ribbon.RibbonButton() });
Console.WriteLine("Ribbon Form is ready for use.");