我注意到另一个人也在这方面寻求帮助。我看了那个帖子,好像还没有解决。我还尝试将我的代码更改为“单击 2 次屏幕截图”帖子中的代码,但由于某种原因,在我的代码中实现该代码会与我的所有其他代码混淆。
目前,屏幕截图在 Win XP 中完美显示。然而,在 Vista 和 Win7 中,除非在窗口模式下玩游戏,否则它们会显示为空白。我希望有人可以帮助我们,因为这是完成我们程序的最后一步,如果没有解决这个问题,我们将无法完成。
我用于屏幕截图的 C# 代码如下。
Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
Screen.PrimaryScreen.Bounds.Y,
0, 0,
Screen.PrimaryScreen.Bounds.Size,
CopyPixelOperation.SourceCopy);