可能重複:
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