Reputation: 27
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.
Upvotes: 2
Views: 1399
Reputation: 31
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.
Upvotes: 1