zoukankan      html  css  js  c++  java
  • 搭建Wpf框架(11) —— 多屏窗口

    遍历显示器显示多屏窗口,获得多屏数据的方法: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>

    作者:竹天笑
    互相学习,提高自己。
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
  • 相关阅读:
    【MySQL】自增步长调整
    【Python】异常
    【Python】单例模式
    rabbitMQ-server 下载地址
    函数(六)---内置函数
    # python04---函数
    python02---基础数据类型
    0001-代码仓库-git 命令
    0001-代码仓库-mvn
    腾讯短信接口使用
  • 原文地址:https://www.cnblogs.com/akwkevin/p/15069437.html
Copyright © 2011-2022 走看看