Graphics.CopyFromScreen返回黑屏黑屏、Graphics、CopyFromScreen

由网友(高冷不是我的范er)分享简介:我有一个小的应用程序,采用截屏并保存到文件夹的。它正常工作的大部分时间,但在某些情况下,例如当在团队要塞2或同时在OpenGL模式下运行魔兽争霸3之只返回一个完全黑色(或白色)的图像。有没有人有办法解决这个问题?我现在用的是C#标准:BMP位图;显卡GFX;BMP =新位图(Screen.PrimaryScreen...

我有一个小的应用程序,采用截屏并保存到文件夹的。它正常工作的大部分时间,但在某些情况下,例如当在团队要塞2或同时在OpenGL模式下运行魔兽争霸3之只返回一个完全黑色(或白色)的图像。有没有人有办法解决这个问题?

我现在用的是C#标准:

  BMP位图;
显卡GFX;
BMP =新位图(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);
 

解决方案

窗口截图功能不从的DirectX复制数据表面。你所要做的是手动像这篇文章描述。

dell台式机开机不显示屏幕怎么办

I have a small application that takes screen shots and saves them to the folder its in. It works fine most of the time, but in some cases, for example while in Team Fortress 2 or while running Warcraft 3 in OpenGL mode it just returns a totally black(or white) image. Does anyone have a way to fix this?

I am using the c# standard:

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);

解决方案

Windows screenshot functions do not copy data from DirectX surfaces. You have to do that manually like described in this article.

阅读全文

相关推荐

最新文章