I use my application on the second monitor, and sometimes on the main computer monitor.
How can I get a screenshot of a second monitor?
The following code does not work for the second monitor ...
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();
source share