最佳解答者
請教一個多螢幕的問題

問題
-
Dear All, 請問一下, 我有兩個螢幕 分別為1366 X768, 1920 X 1080, 我如果要讓Form(WinForm) 的啟始位置, 總是在最後一個螢幕的 (10, 10), 要怎麼做呢? 因為我只有兩個螢幕, 但也許有客戶裝3個螢幕, 原本我的想法是用 AllScreens 去加, 比如我有雙螢幕,
for (int i = 0; i < System.Windows.Forms.Screen.AllScreens.Length - 1; i++)
那麼form的啟始位置就是 (1376, 10), 但這樣的前提是雙螢幕是水平的, 若雙螢幕是重直的(如圖), 就會變成 (10, 778),
那麼要怎麼判斷用戶的螢幕是重直的還是水平的呢?萬一用戶有3個螢幕, 第一個跟第二是水平, 第2跟第3是垂直,
又有什麼方法可以判定呢? 感謝大家的幫忙- 已編輯 ed0507 2016年1月4日 上午 10:57
解答
-
你好,你可以試試這個
this.Location = Screen.AllScreens[Screen.AllScreens.Length - 1].WorkingArea.Location;
大家一齊探討、學習和研究,謝謝!
MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP, MCPD,
MCT, Microsoft Community Star(TW & HK),
Microsoft MVP for VB.NET since 2003
My MSMVP Blog
請記得將對您有幫助的回覆 標示為解答 以幫助其他尋找解答及參與社群討論的朋友們。
Please remember to click Mark as Answer on the post that helps you. This can be beneficial to other community members reading the thread.- 已標示為解答 ed0507 2016年1月5日 上午 06:58
所有回覆
-
你好,你可以試試這個
this.Location = Screen.AllScreens[Screen.AllScreens.Length - 1].WorkingArea.Location;
大家一齊探討、學習和研究,謝謝!
MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP, MCPD,
MCT, Microsoft Community Star(TW & HK),
Microsoft MVP for VB.NET since 2003
My MSMVP Blog
請記得將對您有幫助的回覆 標示為解答 以幫助其他尋找解答及參與社群討論的朋友們。
Please remember to click Mark as Answer on the post that helps you. This can be beneficial to other community members reading the thread.- 已標示為解答 ed0507 2016年1月5日 上午 06:58