我在第二個監視器上使用我的應用程序,有時在計算機的主監視器上使用我的應用程序。在第二個監視器/電視下的主WPF窗口的屏幕截圖
我如何獲得第二臺顯示器的屏幕截圖?
下面的代碼不會爲第二個監視器工作...
Graphics gfx;
Bitmap bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
gfx = Graphics.FromImage(bmp);
gfx.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
MemoryStream ms = new MemoryStream();
bmp.Save(ms, ImageFormat.Jpeg);
byte[] bitmapData = ms.ToArray();
我認爲你需要用更合適的東西來替換'PrimaryScreen'。 – 2012-04-12 20:33:59