[]
Provides access to the viewer's toolbar, allowing for customization and control of toolbar buttons and functionality.
public Viewer.ViewerToolbar Toolbar { get; }
Type | Description |
---|---|
Viewer.ViewerToolbar | A Viewer.ViewerToolbar instance that represents the toolbar in the viewer. |
The toolbar is a key component of the viewer's user interface, offering quick access to common actions such as navigation, zoom, and print. This property allows developers to customize the toolbar to better suit their application's needs.
public void AddCustomButtonToViewerToolbar(Viewer viewer)
{
// Create a new ToolStripButton
var customButton = new ToolStripButton
{
Name = "customButton",
Text = "Custom Action"
};
customButton.Click += CustomButton_Click;
// Add the button to the Viewer's ToolStrip
viewer.Toolbar.ToolStrip.Items.Add(customButton);
}
private void CustomButton_Click(object sender, EventArgs e)
{
// Custom action
MessageBox.Show("Custom action executed.");
}
public void RemoveButtonFromViewerToolbar(Viewer viewer, string buttonName)
{
var item = viewer.Toolbar.ToolStrip.Items[buttonName];
if (item != null)
{
viewer.Toolbar.ToolStrip.Items.Remove(item);
}
}