Specifies the standard items of the Quick Access Toolbar. Additional items can be added and removed through a context menu.
public void SetQuickAccessToolbarStandardItems(System.Windows.Forms.ToolStripItem[] items);
Public Sub SetQuickAccessToolbarStandardItems(items As System.Windows.Forms.ToolStripItem())
Parameter | Description |
---|---|
items | An array of Tool |
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);
Dim strQATImages As String() = {"save.png", "open.png", "newpage.png", "undo.png", "redo.png", "print.png"}
Dim iButtons As Integer = strQATImages.Length
Dim buttons As ToolStripButton() = New ToolStripButton(iButtons - 1) {}
For i As Integer = 0 To iButtons - 1
buttons(i) = New ToolStripButton()
buttons(i).Image = New Bitmap(GetType(RibbonApp), strQATImages(i))
Select Case i
Case 0
buttons(i).Click += OnSaveFile
Exit Select
Case 1
buttons(i).Click += OnOpenFile
Exit Select
Case 2
buttons(i).Click += OnNewDocument
Exit Select
Case 3
buttons(i).Click += OnUndo
Exit Select
Case 4
buttons(i).Click += OnRedo
Exit Select
Case 5
buttons(i).Click += OnPrint
Exit Select
End Select
Next
SetQuickAccessToolbarStandardItems(buttons)