How can I convert graphics object to bitmap object using C#?
Bitmap myBitmap = new Bitmap(width, height, myGraphics);
Alternatively:
Graphics myGraphics = Graphics.FromImage(myBitmap);
// some code with draw on myGraphics
myGraphics.Dispose();
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);
This looks like what you might want: DaniWeb, yes annoyingware but it does provide a working solution
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With