Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one user control page and i have some charts and labels on it. I want to print the whole scrollable page.

What I have tried:

I used :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

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


but i got the error as
"value of type 'userctrl' cannot be converted to 'System.Windows.Forms.Form'".
Posted
Updated 7-Sep-17 8:09am

1 solution

Use a PrintDocument: PrintDocument Class (System.Drawing.Printing)[^] - it lets you specifiy exactly what is printed, and where. It's not as trivial to use as PrintForm, but that's the whole point: PrintForm only prints what it visible to the user at that moment - you need to print the stuff that isn't visible as well. The link includes a basic example, but there is a more complex one here: Passing Parameters to a PrintDocument.PrintPage Event[^] The code is in C# but it's pretty simple, and online converters should tanslate it pretty well if you can't cope.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900