printing a custom control...

  • Thread starter Thread starter Dan Bass
  • Start date Start date
D

Dan Bass

I've got a custom control that makes use of DrawString and DrawBezier, drawn
from the graphics object passed by in the PaintEventArgs for the Paint
event.

I've not printed anything via c# before, but would it be easy to draw on a
PrintDocument the same way I currently am on the control?
Where should I start?
Anything thing to watch for would be the fact the control could grow quite
long (while I can keep the width fixed to the current page width) so it will
need to work over multiple pages.

Thanks for your time and comments.

Daniel.
 
sorted it...

All you need to do is have the drawing code exposed in a method where one
parameter is the Graphics object you're drawing to, as well as the bounds.

For the painting, it would be the PaintEventArgs.Graphics and the
this.Bounds, and for the printing it would be the
PrintDocumentEventArgs.Graphics and the page bounds.

A simple print using a PrintDialog and PrintDocument finishes this off
nicely.
 
Back
Top