在有些情况下我们需要制作无边框圆角透明的窗体,方法如下:
XAML:
<Window x:Class="ImportData.MainWindow" xmlns=" xmlns:x=" Title="MainWindow" Height="350" Width="525" 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(); } }
评论回复