1、首先选中MainWindow,在属性中把AllowsTransportation 的那个单选框给选上;
2、在XAML中添加以下代码
<Canvas >
<Border CornerRadius="5" Width="400" Height="300" Background="Chocolate">
<StackPanel Orientation="Horizontal" FlowDirection="RightToLeft" HorizontalAlignment="Right" VerticalAlignment="Top" Width="60">
<Border Width="20" Height="20" >
<Border.Triggers>
</Border.Triggers>
<TextBlock FontWeight="Bold" Width="20" TextAlignment="Center" Text="x" Foreground="Red"></TextBlock>
</Border>
<Border Width="20" Height="20">
<TextBlock FontWeight="Bold" Width="20" TextAlignment="Center" Text="-" Foreground="Red"></TextBlock>
</Border>
</StackPanel>
</Border>
</Canvas>
3、如果窗体设置成圆角的,运行程序后发现四个角有白色,很简单,只需要设置MainWindow的Background="#00000000"就可以了,最终效果是这样的