Screenshot from second screen
Use Screen.AllScreens instead:
foreach ( Screen screen in Screen.AllScreens )
{
screenshot = new Bitmap( screen.Bounds.Width,
screen.Bounds.Height,
System.Drawing.Imaging.PixelFormat.Format32bppArgb );
// Create a graphics object from the bitmap
gfxScreenshot = Graphics.FromImage( screenshot );
// Take the screenshot from the upper left corner to the right bottom corner
gfxScreenshot.CopyFromScreen(
screen.Bounds.X,
screen.Bounds.Y,
0,
0,
screen.Bounds.Size,
CopyPixelOperation.SourceCopy );
// Save the screenshot
}
The Screen
class has a static property AllScreens
which gives you an array of screens. Those objects have a Bounds
property which you can surely use ...
Long story short: You initialize the bitmap with the size of the desired screen (don't use PrimaryScreen
, because that's only the primary one, as the name implies) and then pass the appropriate boundaries to CopyFromScreen
.