简体   繁体   中英

Convert graphics object to bitmap object

如何使用 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);

这看起来像您可能想要的: DaniWeb ,是的,烦人的软件,但它确实提供了一个可行的解决方案

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM