Screen Capture w/ Dual Monitors

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

need some code for getting screenshots from the secondary monitor on dual
monitor display.

Here's a bit of the code for a screen from the primary monitor.

Bitmap MyImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height, g1);

For the second monitor I can use the Screen.Allscreens method to get and
array of the screens. So far that is looking like this...

Screen[] screens = Screen.Allscreen;

I'm not 100% on that syntax since I don't have the code infront of me but
you get the idea..

Now from that array how do I access the second monitor. I've been successful
in getting dimensions and such like 'screens[1].Bounds.width' or
screen[1].Displayname but I don't know how to get the screen shot via
somthing like...

Bitmap MyImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height, g1);

in the above PrimaryScreen lets the program know to use the primay display,
how do I reference the second monitor?
 
Bitmap MyImage = new Bitmap(Screen.AllScreens[1].Bounds.Width,
Screen.AllScreens[1].Bounds.Height, g1);

that should do it
 
Back
Top