2

I have dual monitors and I am working on a product that allows you to record your computer screen. Currently, I am using the following code:

Rectangle screenArea = Rectangle.Empty; foreach (System.Windows.Forms.Screen screen in System.Windows.Forms.Screen.AllScreens){ screenArea = Rectangle.Union(screenArea, screen.Bounds); }

Which inevitably (in my case) records the entirety of the desktop. With the aspect ratio of both screens, where "screenArea" is the area being recorded. Is there a way in which I can specify the active monitor in which the program is running on?

Thanks for any help, Christopher.

1 Answers1

1

Maybe this could help.

How do I determine which monitor my .NET Windows Forms program is running on?

Also, there is PrimaryScreen Property:

http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.primaryscreen(v=vs.110).aspx

You can get an array of Screens that you have using this code.

Screen[] screens = Screen.AllScreens;

You can also figure out which screen you are on, by running this code (this is the windows form you are on)

Screen screen = Screen.FromControl(this); //this is the Form class

In short check out the Screen class and static helper methods, they might help you.

MSDN Link, doesn't have much..I suggest messing around in the code by yourself.

Community
  • 1
  • 1
  • Alright, I have done a little bit of research and I have come up with this to record the entirety of the screen. It's just a case of trying to stop it from recording my second monitor... // get entire desktop area size Rectangle screenArea = Rectangle.Empty; foreach (System.Windows.Forms.Screen screen in System.Windows.Forms.Screen.AllScreens) { screenArea = Rectangle.Union(screenArea, screen.Bounds); } – Christopher Young Aug 05 '14 at 12:43