ActiveReports 15 .NET Edition
GrapeCity.ActiveReports.Viewer.Win Assembly / GrapeCity.ActiveReports.Viewer.Win Namespace / Viewer.ViewerToolbar Class / MainBar Property

In This Topic
    MainBar Property
    In This Topic
    The main tool strip in the Windows Forms Viewer control.
    Public ReadOnly Property MainBar As ToolStrip
    public ToolStrip MainBar {get;}

    Items on this toolstrip and their index numbers:

    • 0 Toggle sidebar
    • 1 Separator
    • 2 Print
    • 3 Galley mode
    • 4 Separator
    • 5 Copy
    • 6 Find
    • 7 Separator
    • 8 Zoom out
    • 9 Current zoom
    • 10 Zoom in
    • 11 Separator
    • 12 Fit width
    • 13 Fit page
    • 14 Separator
    • 15 Single page view
    • 16 Continuous view
    • 17 Multipage view
    • 18 Refresh
    • 19 Cancel

    You can access these items by index with the Insert and RemoveAt methods. Other methods are described in the System.Windows.Forms.ToolStripItemCollection documentation on MSDN.

    This code removes the print button and replaces it with one that calls a custom print dialog.
    private void Form1_Load(object sender, EventArgs e)
              //Remove the print button. 
              //Remove the extra separator.
              //Add a new button to the end of the main bar with the caption "Print."
              ToolStripButton tsbPrint = new ToolStripButton("Print");
              //Create a click event handler for the button.
              tsbPrint.Click += new EventHandler(tsbPrint_Click);
              SectionReport1 rpt = new SectionReport1();
          //Call the custom dialog from the new button's click event.
          void tsbPrint_Click(object sender, EventArgs e)
    //Call the custom print dialog.
          private void CustomPrint()
              frmPrintDlg _printForm = new frmPrintDlg();
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim rpt As New SectionReport1
        'Remove the print button. 
        'Remove the extra separator.
        'Add a new button to the end of the main bar with the caption "Print."
        Dim tsbPrint As New ToolStripButton("Print")
        'Create a click event handler for the button.
        AddHandler tsbPrint.Click, AddressOf tsbPrint_Click
    End Sub
    'Call the custom dialog from the new button's click event.
    Private Sub tsbPrint_Click(sender As Object, e As EventArgs)
    End Sub
    'Call the custom print dialog.
    Private Sub CustomPrint()
        Dim _printForm As New frmPrintDlg()
    End Sub
    See Also