Reputation: 908
We got some code that implement printing using Printdocument
and it does all the drawing directly on the Graphics
object received in the PrintEventArgs
. It would be more convenient if the code doing the drawing used another canvas and we would add this canvas to the PrintEventArgs
Graphics
after. Since the code already depends on the Graphics
object I need a canvas with this object. I also need a way to copy the canvas onto the PrintEventArgs
Graphics
. I can create a Graphics
from an Image
but as far as I know it needs to be stored on the disk. Any suggestions?
Upvotes: 0
Views: 364
Reputation: 3636
Create an empty bitmap, get the bitmap's graphics object, and do your painting on that. You can save the bitmap to disk or wherever if you need to retrieve it later. Then paint the bitmap on top of your graphics object whenever you need that layer to be added. Should be pretty straightforward.
Upvotes: 1