Xceed Chart for WinForms v4.4 Documentation
Customizing the toolbar

Welcome to Xceed Chart for WinForms v4.4 > Installation Instructions > Integrating into Windows Forms > ChartToolbarControl > Customizing the toolbar

The ChartToolbarControl control can easily be customized with your own buttons at runtime. The following example code adds a user-defined button to the toolbar, which invokes a simple message box.

VB.NET  

Private toolBarButton1 As Xceed.Chart.UIControls.ToolBarButton

Private Sub Form1_Load( ByVal sender As Object, ByVal e As EventArgs)
  ' create the button
  toolBarButton1 = New Xceed.Chart.UIControls.ToolBarButton()
 
  ' create an icon for the button in the toolbar image list
  ' 1. assume that there is an icon called Custom.ico in the startup directory
  Dim ico As New Icon(Application.StartupPath + "\Custom.ico")
  chartToolbarControl1.ImageList.Images.Add( ico )
 
  ' assign it to the toolbar button
  toolBarButton1.ImageIndex = chartToolbarControl1.ImageList.Images.Count - 1
 
  ' add the button directly in the Buttons collection inherited from ToolBar
  'chartToolbarControl1.Buttons.Add( toolBarButton1 );
End Sub

C#  

private Xceed.Chart.UIControls.ToolBarButton toolBarButton1;

private void Form1_Load( object sender, EventArgs e )
{
  // create the button
  toolBarButton1 = new Xceed.Chart.UIControls.ToolBarButton();
 
  // create an icon for the button in the toolbar image list
  // 1. assume that there is an icon called Custom.ico in the startup directory
  Icon ico = new Icon(Application.StartupPath + "\\Custom.ico");
  chartToolbarControl1.ImageList.Images.Add( ico );
 
  // assign it to the toolbar button
  toolBarButton1.ImageIndex = chartToolbarControl1.ImageList.Images.Count - 1;
 
  // add the button directly in the Buttons collection inherited from ToolBar
  //chartToolbarControl1.Buttons.Add( toolBarButton1 );
}

Related Examples

Windows Forms: Visual Interface Components\Chart Toolbar

See Also

ChartToolbarControl