Home All Groups Group Topic Archive Search About
Author
23 Jan 2006 7:40 PM
Marco Rego
How do I save or transform a System.Drawing.Graphics object into an Image
object ?
What I need is to save a Graphics on which I have drawn several shapes to a
JPG or PNG file.
Thanx.

_____
Marco

Author
23 Jan 2006 8:43 PM
Tim Wilson
If you're in control of the creation of the Graphics object then you can do
something like this.

Bitmap b = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(b);
// Draw on the image using g.DrawEllipse(...), g.DrawLine(...), etc.
b.Save(...);
g.Dispose();
b.Dispose();

--
Tim Wilson
..NET Compact Framework MVP

Show quote
"Marco Rego" <MarcoR***@discussions.microsoft.com> wrote in message
news:A0682A0C-2FFF-4340-98E0-DA5057CEE675@microsoft.com...
> How do I save or transform a System.Drawing.Graphics object into an Image
> object ?
> What I need is to save a Graphics on which I have drawn several shapes to
a
> JPG or PNG file.
> Thanx.
>
> _____
> Marco

AddThis Social Bookmark Button