Hi,

I have a form in VB which is scrollable (using autoscroll) and when I currently click
'print', it only prints what I can see; it takes a screenshot of the viewable information. Here's my code:

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
        Dim settings As New System.Drawing.Printing.PrinterSettings

        sPrintForm.PrinterSettings = settings
        settings.DefaultPageSettings.Landscape = True

       sPrintForm.PrintAction = Printing.PrintAction.PrintToPreview

       sPrintForm.Print()
    End Sub

Could somebody please show me how to print the whole of the page, including the areas that can't be seen?

Thanks in advance :) (See attached file for image)

Recommended Answers

All 8 Replies

Hi,

I have a form in VB which is scrollable (using autoscroll) and when I currently click
'print', it only prints what I can see; it takes a screenshot of the viewable information. Here's my code:

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
        Dim settings As New System.Drawing.Printing.PrinterSettings

        sPrintForm.PrinterSettings = settings
        settings.DefaultPageSettings.Landscape = True

       sPrintForm.PrintAction = Printing.PrintAction.PrintToPreview

       sPrintForm.Print()
    End Sub

Could somebody please show me how to print the whole of the page, including the areas that can't be seen?

Thanks in advance :) (See attached file for image)

The Print form control is there in the Visual Basic PowerPacks toolbox

To print the complete client area of a scrollable form
1.In the Toolbox, click the Visual Basic PowerPacks tab and then drag the PrintForm component onto the form.

The PrintForm component will be added to the component tray.

2.In the Properties window, set the PrintAction property to PrintToPrinter.

3.Add the following code in the appropriate event handler (for example, in the Click event handler for a Print Button).

PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)

Try once

Thanks. I gave it a trym but it still didn't work, it only seems to want to print the visible area. This is my new code.

Dim settings As New System.Drawing.Printing.PrinterSettings

        sPrintForm.PrinterSettings = settings
        settings.DefaultPageSettings.Landscape = True

       
        sPrintForm.PrintAction = Printing.PrintAction.PrintToPreview
        
        sPrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)

Any other ideas?

Thanks in advance :)

d

I am too stuck with the same problem. Inspite of setting the AutoScroll property of the form to TRUE and invoking
sPrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollablle) it prints only the visible area. Anyone found solution to this? Please help!

The Print form control is there in the Visual Basic PowerPacks toolbox

To print the complete client area of a scrollable form
1.In the Toolbox, click the Visual Basic PowerPacks tab and then drag the PrintForm component onto the form.

The PrintForm component will be added to the component tray.

2.In the Properties window, set the PrintAction property to PrintToPrinter.

3.Add the following code in the appropriate event handler (for example, in the Click event handler for a Print Button).

PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.FullWindow)

Hi neither Scrollable nor FullWindow option is working! It is printing only the visible area in ONE page only. How do we print all the data in multiple pages. Not sure what I am missing..

collin_ola - Did u find any solution?

You can do one thing....Give user the option for preview so that he/she can make settings and similarly print the form....

Sorry. Either PrintToPreview or PrintToPrinter generated only the visible area ie only one page even if printing SCROLLABLE. Whatever setting may be made I am not able to see the second page...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.