Printer Dialog AR11 from windows Pro designer

Posted by: darin on 26 August 2019, 3:29 pm EST

    • Post Options:
    • Link

    Posted 26 August 2019, 3:29 pm EST - Updated 30 September 2022, 5:37 pm EST

    We are using the windows pro winviewer. That has a printer icon on the top left of the tool bar. When that is clicked, there is a large delay before the screen is displayed. Yes, it has to do with the number of printers that are installed. Yet, when i pull up a printer selection box in our software, there is no delay at all.

    I have seen other posts on the forums about delays in getting this to display, some say they were solved and answered, yet i can’t seem to get any of those solutions to work.

    Since the winviewer has the printer icon on the toolbar, i don’t know what that is doing to change the printer dialog box or anything. I don’t know what event is being done when it is clicked.

    Our customers are starting to complain about it.

    Attached are 2 PNG - one is the dialog box we create from our software (and we would send the printer name to the viewer for it to print the report), the other is the printer dialog from the winviewer when we have displayed it on the screen and the user clicks the Printer icon.

  • Posted 26 August 2019, 3:30 pm EST

    More information

    As you can tell from the images, we appear to be using the same printer dialog box, it just takes < 1/4 of a second from our software, whereas it takes about 5 seconds from the winviewer.

  • Posted 27 August 2019, 1:19 am EST

    Hello Darin,

    AR use the Advanced printer dialog which is slower than the Standard dialog. If you want to change the Advanced dialog to Standard dialog, then you need to remove the default “Print” ToolStripButton from the viewer and add your own “Print” ToolStripButton. Please refer the following code:

    
      public Form1()
            {
                InitializeComponent();
                //Remove the print button. 
                viewer1.Toolbar.ToolStrip.Items.RemoveAt(2);
                //Remove the extra separator.
                viewer1.Toolbar.ToolStrip.Items.RemoveAt(1);
                //Add a new button to the end of the tool strip with the caption "Print."
                ToolStripButton tsbPrint = new ToolStripButton("Print");
                viewer1.Toolbar.ToolStrip.Items.Add(tsbPrint);
                //Create a click event handler for the button.
                tsbPrint.Click += new EventHandler(tsbPrint_Click);
                viewer1.LoadDocument("../../PageReport1.rdlx");
            }
    
            private void tsbPrint_Click(object sender, EventArgs e)
            {
                viewer1.Print(GrapeCity.Viewer.Common.PrintingSettings.ShowPrintDialog|GrapeCity.Viewer.Common.PrintingSettings.UseStandardDialog);
            }
    
    

    Also, please refer to the attached sample for implementing the same,

    Thanks.

    Print_OverRide.zip

  • Posted 27 August 2019, 2:02 am EST

    Hello,

    Please use the attached sample for the Report Designer.

    
     reportDesigner.DesignerTabChanged += ReportDesigner_DesignerTabChanged;
        int i = 1;
            private void ReportDesigner_DesignerTabChanged(object sender, DesignerTabChangedEventArgs e)
            {
              if(i==1)
                {
                    if (e.ActiveTab == DesignerTab.Preview)
                    {
    
                        reportDesigner.ReportViewer.Toolbar.ToolStrip.Items.RemoveAt(2);
                        //Remove the extra separator.
                        reportDesigner.ReportViewer.Toolbar.ToolStrip.Items.RemoveAt(1);
                        //Add a new button to the end of the tool strip with the caption "Print."
                        ToolStripButton tsbPrint = new ToolStripButton("Print");
                        reportDesigner.ReportViewer.Toolbar.ToolStrip.Items.Add(tsbPrint);
                        //Create a click event handler for the button.
                        tsbPrint.Click += new EventHandler(tsbPrint_Click);
                        i++;
                    }
                }
              
            }
    
            private void tsbPrint_Click(object sender, EventArgs e)
            {
                reportDesigner.ReportViewer.Print(GrapeCity.Viewer.Common.PrintingSettings.ShowPrintDialog | GrapeCity.Viewer.Common.PrintingSettings.UseStandardDialog);
            }
    
    

    Thanks.

    C#.zip

  • Posted 27 August 2019, 10:54 am EST

    Thank you for your help. i was able to get your print button removed and a new one added. I would have liked to have removed your click routine to use ours, but i couldn’t figure out the name of your handler for it.

    We use VB, so the below code might help anyone else that needs to remove the button and create a new one:

    Dim TSbutton As ToolStripButton

    For Each xitem As Object In ARViewer.ReportViewer.Toolbar.ToolStrip.Items

    If TypeOf xitem Is ToolStripButton Then

    TSbutton = DirectCast(xitem, ToolStripButton)

    If UCase(TSbutton.Name) = “TSBPRINT” Then

    ARViewer.ReportViewer.Toolbar.ToolStrip.Items.Remove(TSbutton)

    Dim tsbPrint As New ToolStripButton(“Print”)

    ARViewer.ReportViewer.Toolbar.ToolStrip.Items.Add(tsbPrint)

    AddHandler tsbPrint.Click, AddressOf tsbPrint_Click

    Exit For

    End If

    End If

    Next

    Private Sub tsbPrint_Click(ByVal sender As Object, ByVal e As System.EventArgs)

    ARViewer.ReportViewer.Print(GrapeCity.Viewer.Common.PrintingSettings.ShowPrintDialog Or GrapeCity.Viewer.Common.PrintingSettings.UseStandardDialog)

    End Sub

  • Posted 28 August 2019, 5:05 am EST

    Hello Darin,

    It is not possible to override the handler of the existing Print Button. You need to remove the default print button and add your own button to write your own click routine.

    Thanks.

Need extra support?

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

Learn More

Forum Channels