遍历显示器显示多屏窗口,获得多屏数据的方法:System.Windows.Forms.Screen.AllScreens
if (LocalSetting.ScreenMode == "Full") { var mainwindow = Application.Current.MainWindow; mainwindow.WindowState = WindowState.Maximized; mainwindow.Topmost = true; var localscreen = System.Windows.Forms.Screen.FromRectangle(new System.Drawing.Rectangle((int)mainwindow.Left, (int)mainwindow.Top, (int)mainwindow.Width, (int)mainwindow.Height)); foreach (var screen in System.Windows.Forms.Screen.AllScreens) { if (screen.DeviceName != localscreen?.DeviceName) { var otherwindow = new OtherMainWindow(); otherwindow.Show(); otherwindow.Top = screen.WorkingArea.Top; otherwindow.Left = screen.WorkingArea.Left; otherwindow.Height = screen.WorkingArea.Height; otherwindow.Width = screen.WorkingArea.Width; otherwindow.Topmost = true; otherwindow.WindowState = WindowState.Maximized; _regionManager.RegisterViewWithRegion(otherwindow.RegionName, typeof(MainView)); } } }
本框架中需要将配置文件中的ScreenMode改成Full即可。启动主界面会自动打开其他屏幕的界面。
<appSettings>
<add key="Title" value="AIStudio"/>
<add key="Language" value="中文"/>
<add key="FontSize" value="16"/>
<add key="FontFamily" value="宋体"/>
<add key="Accent" value="BlueGray"/>
<add key="Theme" value="BaseGray11"/>
<add key="NavigationLocation" value="Left"/>
<add key="NavigationAccent" value="Dark"/>
<add key="TitleAccent" value="Normal"/>
<add key="ToolBarLocation" value="Top"/>
<add key="StatusBarLocation" value="Bottom"/>
<add key="VerifyMode" value=""/>
<add key="ScreenMode" value="Full"/>
<add key="Version" value="2.0.0.0"/>
<add key="ServerIP" value="http://121.36.12.76:5000"/>
<add key="UpdateAddress" value="http://121.36.12.76:5000/Update/AutoUpdater.xml"/>
<add key="ConString" value="Data Source=Admin.db"/>
<add key="DatabaseType" value="SQLite"/>
<add key="DeleteMode" value="Logic"/>
</appSettings>