VB.NET How to print a form without cropping a part of it?

1.6k Views Asked by At

I am currently using Power Packs to print my form. And with this line of code, I am able to print the form.

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

But during print preview, the form is cropped into half because my form is scroll-able. Here is the picture. This is the running application. enter image description here

And this is the print preview. enter image description here

How can I print a report nicely in A4 paper size? I have been searching tutorials online but can't find any good ones. Hope you guys can recommend me a good method to print a report. Either using powerpacks or the normal print controls doesnt matter.

1

There are 1 best solutions below

10
On

Unfortunately, printform can only print the part of your form that is visible the moment you call .print.

What you can do is to :

  1. dock (in the properties, there is a dock parameter) your groupbox
  2. include all of your controls in your groupbox(all your labels)
  3. adjust the anchor so that the controls follow your form when you resize it.

Alternatively, you can use crystal reports instead for PDF reports or Microsoft office interop for an Excel/Word Report.