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.

4

1 回答 1

1

也许这会有所帮助。

如何确定我的 .NET Windows Forms 程序在哪个监视器上运行?

此外,还有 PrimaryScreen 属性:

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

您可以使用此代码获得一组屏幕。

Screen[] screens = Screen.AllScreens;

您还可以通过运行此代码来确定您在哪个屏幕上(这是您所在的 Windows 窗体)

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

简而言之,查看 Screen 类和静态辅助方法,它们可能会对您有所帮助。

MSDN Link,没有太多..我建议自己搞乱代码。

于 2014-08-05T12:32:04.537 回答