print the entire form?

NelsonB

Member
Joined
Sep 26, 2011
Messages
9
Programming Experience
3-5
Me again.

How on earth can I print the entire form which is about 3 or 4 pages total ??

I used the Print'something'() function and it only takes a screenshot and prints it, but not the entire form.

Any one please?

Thanks.
 
PrintForm.Print method allow you to specify print option Scrollable.
 
Thanks for your reply JohnH.

I searched for the PrintForm.Print method and I found this Microsoft forum answer/suggestion:
How do I print a form in VB.NET?

It basically says there are two ways to print a form in VB.NET:

1.
Using PrintDocument, PrintDialog components
2.
Using PrintForm component in Visual Basic Power Packs

I tried both ways and the only thing I'm able to print is a screenshot of the form where it is positioned on the screen (screenshot duh! :))

I currently have this which is using the second approach:


Private
Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)
End
Sub

Obviously I'm missing something somewhere.

I'll appreciate any help.

Thanks.
 
NelsonB said:
Obviously I'm missing something somewhere.
From what I can see you got it right. The Scrollable option does this which it seems was what you asked for:
Uses a new implementation to print the full client area, even if part of it is scrolled out of view.
I can see now though, that if the form that spans several window client areas ("screen pages") when scrolled also spans more than one paper page, it will only print the first one. For that the PrintForm component has no resolution, it will only draw that image one time, thus it ends when page ends.
PrintDocument is more of a do it yourself thing, where you draw strings and lines if you will at specific locations to print page, and have to dynamically manage the output for more pages. There could be derived classes available that could provide some kind of reporting output depending on what the source data might be.
 
So I found a semi-old post in this same forum which is about the same problem I have:

http://www.vbdotnetforums.com/reporting-printing/40622-print-scrollable-form.html

Any ideas / examples about this?

I have tried several code I have found from everywhere on the net and I can get to print either a single screenshot or a plain blank page.

Obviously this is the first time I'm in the need of printing a form, and honestly, I can't believe how complicated it seems to be for a simple multi-page printing.

Thanks.
 
When you see the content of the application exceeding what can be displayed on screen you should consider rearranging the UI. I think the limitations of the simple PrintForm component is reasonable.

PrintDocument component allow you to output any content anyhow you like to a printer, without limitations, using simple and familiar Graphics methods. There should be no lack of web resources explaining usage for both the PrintDocument and the Graphics classes. If the source data is something simple as a DataTable it is highly likely that many has done the "work" before you and posted reusable classes on the web, if not you need to put some more work into it than just calling the Print method of PrintForm component.
 
Back
Top