WPF 不遮挡任务栏最大化和全屏显示
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                WPF 不遮挡任务栏最大化和全屏显示
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                ?在窗體不去邊框的情況下,不遮擋任務欄最大化
MainWindow.xaml.cs
MainWindow.xaml
<Window x:Class="thzSoftware.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:thzSoftware"mc:Ignorable="d"Title="MainWindow" Height="450" Width="800" WindowState="Maximized"><Grid ShowGridLines="True" Margin="5"><Grid.RowDefinitions><RowDefinition Height="*"></RowDefinition><RowDefinition Height="*"></RowDefinition></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/><ColumnDefinition Width="4*"/></Grid.ColumnDefinitions><Image Name="Cam1" Grid.Row="0" Grid.Column="0" Source="C:\Users\admin\source\repos\thzSoftware\thzSoftware\bin\Debug\Cam1.jpg"/><Image Name="Cam2" Grid.Row="1" Grid.Column="0" Source="C:\Users\admin\source\repos\thzSoftware\thzSoftware\bin\Debug\Cam2.jpg"/></Grid> </Window>運行結果:窗體的尺寸:1936*1056
2.?用代碼?最大化
方式1:不包括窗體邊框
這樣窗體實際上并沒有最大化,尺寸只有 1920?*1040
方式2:不包括窗體邊框
this.Width?=?System.Windows.SystemParameters.PrimaryScreenWidth;得到屏幕整體寬度this.Height?=?System.Windows.SystemParameters.PrimaryScreenHeight;這樣窗體實際上并沒有最大化,尺寸只有 1920?*1080
方式3:包括邊框
this.Height?=?SystemParameters.MaximizedPrimaryScreenHeight;this.Width?=?SystemParameters.MaximizedPrimaryScreenWidth;運行結果:窗體的尺寸:1936*1056 ?用此方式就行
3. 全屏顯示:
方式1:
方式2:
歡迎關注公眾號:?dotnet編程大全
技術群:?需要進技術群的添加小編微信mm1552923,備注:加群;
總結
以上是生活随笔為你收集整理的WPF 不遮挡任务栏最大化和全屏显示的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: .NET 6新特性试用 | Priori
 - 下一篇: 2021,我在枯燥乏味中寻找坚持下去的理