<Window x:Class="WpfApplication5.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" AllowsTransparency="True" WindowStyle="None"
MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Window.Background>
<ImageBrush ImageSource="shapes.png"></ImageBrush>
</Window.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Name="button1" Grid.Row="1" Grid.Column="1" Margin="10,40,10,40" Click="button1_Click">关闭不规则的窗口</Button>
</Grid>
</Window>
private void button1_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();}
}