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>

    作者:竹天笑
    互相学习,提高自己。
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
  • 相关阅读:
    OK335xS-Android mkmmc-android-ubifs.sh hacking
    OK335xS-Android pack-ubi-256M.sh hacking
    OK335xS Ubuntu 12.04.1 版本 Android 开发环境搭建
    Qt Quick Hello World hacking
    Qt QML referenceexamples attached Demo hacking
    QT 5.4.1 for Android Ubuntu QtWebView Demo
    I.MX6 working note for high efficiency
    QT 5.4.1 for Android Windows环境搭建
    mkbootimg hacking
    Generate And Play A Tone In Android hacking
  • 原文地址:https://www.cnblogs.com/akwkevin/p/15069437.html
Copyright © 2011-2022 走看看