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>

    作者:竹天笑
    互相学习,提高自己。
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
  • 相关阅读:
    HDU3461 Code Lock 并查集应用
    记录,待总结8
    HDU1325 Is It A Tree?
    函数指针总结
    记录,待总结6
    HDU1272 小希的迷宫 并查集
    记录,待总结10
    记录,待总结9
    C# 获取radiobutton的值
    解决idea控制台tomcat输出中文乱码
  • 原文地址:https://www.cnblogs.com/akwkevin/p/15069437.html
Copyright © 2011-2022 走看看