Printing GDI drawings

  • Thread starter Thread starter Flare
  • Start date Start date
F

Flare

Hi. I have made a simple painting applcation.

I have a mainform wich creates a class called drawingPanelwich inherit from
Panel. In the drawingPaneli have overriden onPaint an the the painting.

Now on my mainform i have a button called Print. I know how to print
.....PrintPageEventArgs e (e.graphics......)

But HOW do i get the things i ave painted on the drawingPanel? I cant see
how i can access this temporary paint job. How is this normally done?

Thanks in regards
Anders
 
Hi,

I'd recommend to have a single painting routine instead which would be able
to draw on any given Graphics. This way, you would use the single routine to
draw on the panel as well on the e.graphics within the PrintPage event
handler.

Bear in mind though that the resolution on these Graphics can be quite
different - a picture looking quite big on the screen can look much smaller
when printed. So the routine should possibly adjust for different DPIs and
so on. I am not an expert in this field, unfortunately, so I cannot give any
detailed advice on how to allow for printer/screen resolution. I think you
can post such questions to the WinForms/GDI+ newsgroup to get more help from
experts there.
 
The framework extensions libraries I have developed contain a method to
print images (single command!), optionally with pre-defined settings. It
will scale the image to fit the allocated area.

Fully documented. Requires .NET framework 1.1 or later.

You will be allowed to use the libraries in any application - private or
commercial, and distribute them as part of your application, royalty-free.

E-mail me for your free copy: (e-mail address removed)
Your acceptance of the license agreement will be required.

Ori
 
Back
Top