我有一个小应用程序,它拍摄屏幕截图并将它们保存到它所在的文件夹中。它大部分时间都可以正常工作,但在某些情况下,例如在 Team Fortress 2 中或在 OpenGL 模式下运行魔兽争霸 3 时,它只会返回一个完全黑色(或白色)的图像。有没有人有办法解决这个问题?
我正在使用 c# 标准:
Bitmap bmp;
Graphics gfx;
bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
gfx = Graphics.FromImage(bmpScreenshot);
gfx.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bmpScreenshot.Save("image.jpg", ImageFormat.Jpeg);