搭建Wpf框架(11) —— 多屏窗口

AIStudio框架汇总及介绍

遍历显示器显示多屏窗口,获得多屏数据的方法:System.Windows.Forms.Screen.AllScreens

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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));
                    }
                }
}<br><br><br>本框架中需要将配置文件中的ScreenMode改成Full即可。启动主界面会自动打开其他屏幕的界面。<br><br>

<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>

posted @   竹天笑  阅读(1348)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
点击右上角即可分享
微信分享提示