WPF系列二:窗口模式调整
NoResize
设置:ResizeMode="NoResize",窗口大小不能调整,最大化、最小化按钮也不显示
<Window x:Class="WPFDemo.ResizeMode.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:WPFDemo.ResizeMode"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
ResizeMode="NoResize">
<Grid>
</Grid>
</Window>
运行效果:
CanMinimize
设置:ResizeMode="CanMinimize",窗口大小不能跳转,窗口显示最大化、最小化按钮,但是最大化按钮不可用,窗口只能最小化和恢复
<Window x:Class="WPFDemo.ResizeMode.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:WPFDemo.ResizeMode"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
ResizeMode="CanMinimize">
<Grid>
</Grid>
</Window>
运行效果:
CanResize
设置:ResizeMode="CanResize",窗口大小可调整,最大化、最小化按钮都显示,且都可用
<Window x:Class="WPFDemo.ResizeMode.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:WPFDemo.ResizeMode"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
ResizeMode="CanResize">
<Grid>
</Grid>
</Window>
运行效果:
CanResizeWithGrip
设置:ResizeMode="CanResizeWithGrip",窗口可调整大小,最大化、最小化按钮都可用且都显示,右下角还会显示可调整大小的握柄
<Window x:Class="WPFDemo.ResizeMode.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:WPFDemo.ResizeMode"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
ResizeMode="CanResizeWithGrip">
<Grid>
</Grid>
</Window>
运行效果: