WPF圆角透明无边框窗体

时间:2023-02-14 22:17:41
<Window x:Class="ImportData.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="" Width="" Background="{x:Null}" WindowStyle="None" MouseDown="Window_MouseDown" AllowsTransparency="True">
<Grid>
<Border CornerRadius="8,8,8,8" Background="Black" Height="Auto"></Border>
</Grid>
</Window>

窗体移动须加上

private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if(e.LeftButton==MouseButtonState.Pressed)
{
DragMove();
}
}