Solved

Print a already existing Graphics object

Posted on 2004-08-15
3
224 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

628 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