Solved

Print a already existing Graphics object

Posted on 2004-08-15
3
221 Views
Last Modified: 2008-02-26
Hello

I have previously created a Graphics object and I would like to print it.

The problem is the PrintPage handler is passed a Graphics in the EventArgs and that's what's used.

I am trying to do something like this
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
  ev.Graphics = g;  //Where g is the graphics I have already saved.  But ev.Graphics is read only...
}

Is there a way to do what I am asking?

Regards,
NTAC
0
Comment
Question by:NTAC
  • 2
3 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11804772
write to a bitmap in a memory stream ... then draw the bitmap object in e.Graphics

0
 
LVL 4

Author Comment

by:NTAC
ID: 11805468
Greg can you post an example of writing to a bitmap in a memory stream?  

I looked up the Bitmap class, and there is a Bitmap(stream) constructor, but I'm not sure how to get my Graphics g into a stream.

Regards,
NTAC
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 350 total points
ID: 11805754
from looking at another question where you detail why you wanted to do this ...

"as for your graphics question I believe this gets done for you as well (it just reuses the graphics object 4 times) it won't ask you to draw it for each of the 4 copies (they are copies I mean why would it ask 4 times)

theres alot of detailed info here http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsPrinting.aspx"

0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with exporting to excel 4 36
transition to visual .net from vb6 5 41
Groupbox Control ? 2 19
How to repeat the data 4 18
IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question