How can I convert graphics object to bitmap object using C#?
+1
A:
Bitmap myBitmap = new Bitmap(width, height, myGraphics);
Alternatively:
Graphics myGraphics = Graphics.FromImage(myBitmap);
// some code with draw on myGraphics
myGraphics.Dispose();
DreamWalker
2009-10-08 05:16:37
+2
A:
Do you mean System.Drawing.Graphics ? The Graphics class is a surface to an image and is already a bitmap.
What are you trying to do with it ?
using(Graphics g = Graphics.FromImage(bitmap))
{
//draw here
}
or
Bitmap bmp = new Bitmap(100,100,graphics);
Andrew Keith
2009-10-08 05:17:53