wpf-无边框窗体

创建无边框的圆角窗口

<Window x:Class="WpfApp1.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:WpfApp1"
mc:Ignorable="d" Topmost="True" Background="Transparent" AllowsTransparency="True"
WindowStyle="None" MouseLeftButtonDown="Window_MouseLeftButtonDown"
Title="MainWindow" Height="100" Width="200">
<Grid>
<Border BorderThickness="1" BorderBrush="Gray" CornerRadius="15,15,15,15" Background="Azure">
<!--你窗体中要显示的内容-->
<StackPanel Orientation="Horizontal">
<Button Content="查询" Height="28" HorizontalAlignment="Left" Name="btnQuery" VerticalAlignment="Center" Width="48" Click="btnQuery_Click" />
</StackPanel>
</Border>

</Grid>
</Window>

private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}

// 最大化、最小化
WindowState = WindowState.Maximized;
WindowState = WindowState.Minimized;