[C#] 纯文本查看 复制代码
public static Bitmap GetBitmap(API.RECT rect)
{[/b][/color]
[color=#ff0000][b]//要截图的长宽
int width = rect.X2 - rect.X1;
int height = rect.Y2 - rect.Y1;
Bitmap image = new Bitmap(width, height);[/b][/color]
[color=#ff0000][b]
//创建画布
Graphics g = Graphics.FromImage(image);
g.CopyFromScreen(rect.X1, rect.Y1, 0, 0, image.Size);
返回Bitmap
return image;
}