views:

33

answers:

2

We've got a complex Winforms app with each form potentially containing multiple sub forms and have a requirement to be able to print the data contained in these forms.

Currently we are using the PrintDocument control. For each form (or form element) that we are looking to print, we are calling the Control.DrawToBitmap() method, then drawing that to the Graphics object when printing.

This mostly works, and we have workaround for printing the entire contents of forms with scrollable content.

However, we're experiencing 2 problems.

1) The quality of the print out is very low, and in many cases barely readable; And

2) The print out looks quite different depending on the user's screen resolution

Are there any good solutions for printing C# forms? Surely this is a problem that's been solved before? I'd love a method that doesn't require me to essentially re-implement the front end (as with Crystal Reports)

A: 

I've heard of these guys but haven't used them myself: http://www.winformreports.co.uk/

SteveCav
A: 

You may want to increase the size of the bitmaps/rects you are drawing to. If the bitmap resolution is low, it won't look good on a printed piece of paper. Monitors are lucky if they are upwards of 120 pixels/points per inch, and although most printers can print at 150dpi, a printers default setting is typically 300/600dpi. I don't know if the PageUnit measurements have an affect on the output using the PrintDocument, but I use GraphicsUnit.Point when drawing on the surface. (Of course don't make the bitmap TOO big or printing speed will diminish or fail due to the amount of data being sent to the printer).

Erik Philips