可能重复:
How do I find what screen the application is running on in C#运行应用
任何想法来检查当前应用程序是否在双屏幕环境中运行主屏幕上或不?我正在使用VSTS 2008 + C#+ .Net 3.5。我想在我的应用程序中添加代码来检测当前应用程序是否在主屏幕上运行。
由于事先 乔治
可能重复:
How do I find what screen the application is running on in C#运行应用
任何想法来检查当前应用程序是否在双屏幕环境中运行主屏幕上或不?我正在使用VSTS 2008 + C#+ .Net 3.5。我想在我的应用程序中添加代码来检测当前应用程序是否在主屏幕上运行。
由于事先 乔治
未测试:(没有在目前的双屏幕设定,以测试)
bool onPrimary = this.Bounds.IntersectsWith(Screen.PrimaryScreen.Bounds);
其中“这”的主要表现形式的应用。
编辑:刚刚测试过它,它按预期工作。
您可以使用Screen类来告诉您某个控件是否在特定的屏幕上。您也可以获得主要监视,并且每个屏幕对象也都有一个主要属性,指示它是否是主要监视。
这是msdn article。
您应该能够使用它像这样:
var monitor = Screen.FromControl(this);
if (monitor.Primary) //the monitor returned is the primary monitor