0
我正在開發將安裝在雙顯示器(兩個1920x1080 = 3840x1080)上的應用程序。我的開發機器是1440x900,在開發過程中我沒有顯示器。我無法想象如何創建一個窗口大小爲3840x1080(比我的開發桌面屏幕大),窗口只是最大化到1440x900,但不超出。創建大於桌面屏幕的應用程序窗口
我正在開發將安裝在雙顯示器(兩個1920x1080 = 3840x1080)上的應用程序。我的開發機器是1440x900,在開發過程中我沒有顯示器。我無法想象如何創建一個窗口大小爲3840x1080(比我的開發桌面屏幕大),窗口只是最大化到1440x900,但不超出。創建大於桌面屏幕的應用程序窗口
One of the way in which you can do this this to analyze the form screen size.
This is the working example:
if (System.Windows.Forms.Screen.AllScreens.Length == 2 &&
System.Windows.Forms.Screen.AllScreens[0].WorkingArea.Width == System.Windows.Forms.Screen.AllScreens[1].WorkingArea.Width) {
// dual-display logic
System.Drawing.Rectangle sl = System.Windows.Forms.Screen.AllScreens[0].WorkingArea;
System.Drawing.Rectangle sr = System.Windows.Forms.Screen.AllScreens[1].WorkingArea;
Application.Current.MainWindow.Left = sl.Left;
Application.Current.MainWindow.Top = sl.Top;
Application.Current.MainWindow.Width = sr.Width + sl.Width;
Application.Current.MainWindow.Height = sl.Height;
} else {
// single-display logic
System.Drawing.Rectangle s = System.Windows.Forms.Screen.AllScreens[0].WorkingArea;
Application.Current.MainWindow.Left = s.Left; Application.Current.MainWindow.Top = s.Top; Application.Current.MainWindow.Width = (s.Width/2); Application.Current.MainWindow.Height = s.Height;
}
希望這會對你有用。
'Width =「3840」Height =「1080」'? – Abion47