开发者

Convert graphics object to bitmap object

开发者 https://www.devze.com 2022-12-08 04:07 出处:网络
How can I convert开发者_如何转开发 graphics object to bitmap object using C#?Bitmap myBitmap = new Bitmap(width, height, myGraphics);

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

0

精彩评论

暂无评论...
验证码 换一张
取 消