Link to home
Start Free TrialLog in
Avatar of NTAC
NTAC

asked on

Print a already existing Graphics object

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
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

write to a bitmap in a memory stream ... then draw the bitmap object in e.Graphics

Avatar of NTAC
NTAC

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial