Can anyone help me in getting the controls in the toolstrip control of the PrintPreview Dialog

Posted by: leomathew on 8 September 2017, 12:30 pm EST

  • Posted 8 September 2017, 12:30 pm EST

    I was able to get the toolstrip control which contains the Print/Zoom/Different number of pages/Close and page counter combo box.

    But i was not able to get the controls in the toolstrip.The help file too did not contain any information about it.

    public void Test1(object sender, PrintPreviewShowingEventArgs e)
       PrintPreviewDialog dialogWindow = _gridSpreadView.GetPrintPreview();
       Messagebox.Show(dialogWindow .Controls[1].Name) //This gave the toolstrip, but i did not find any property to get access to the controls in the toolstrip.
    } me if anyone knows about this.

  • Replied 8 September 2017, 12:30 pm EST

    You would need to cast the dialogWindow.Controls[1] to a ToolStrip. Then you could loop through each item in the ToolStrip. For instance.   

            Dim pvd As New PrintPreviewDialog
            Dim obj1 As Object
            Dim obj2 As Object
            Dim tools As ToolStrip

            For Each obj1 In pvd.Controls
                If TypeOf obj1 Is ToolStrip Then
                    tools = CType(obj1, ToolStrip)
                    For Each obj2 In tools.Items

                End If


  • Replied 8 September 2017, 12:30 pm EST


    I would suggest using the QuickWatch button to find out information about the ToolStrip object if you can not find the information in the online help file. Here is code to change the tooltip on the Print button.

      <SPAN class=kwd>public void</SPAN> Test1(<SPAN class=kwd>object</SPAN> sender, PrintPreviewShowingEventArgs e)
    ToolStrip ts (ToolStrip)(e.PreviewDialog.Controls[1]);
    (ToolStripButton))(ts[0]).ToolTipText = <SPAN class=st>"myPrintTip"</SPAN>;
  • Replied 8 September 2017, 12:30 pm EST

    Thank you very much Kevin.
  • Replied 8 September 2017, 12:30 pm EST

    Thanks Scott
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels