WPF的小示例
1、
<Window x:Class="GadgetWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300" AllowsTransparency="True" WindowStyle="None" Background="Transparent" MouseLeftButtonDown="Window_MouseLeftButtonDown"> <Grid> <Ellipse Fill="Red" Opacity="0.5" Margin="20"> <Ellipse.BitmapEffect> <DropShadowBitmapEffect/> </Ellipse.BitmapEffect> </Ellipse> <Button Margin="100" Click="Button_Click" Content="Close"> <Button.BitmapEffect> <DropShadowBitmapEffect/> </Button.BitmapEffect> </Button> </Grid> </Window>
void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.DragMove(); } void Button_Click(object sender, RoutedEventArgs e) { this.Close(); }
效果图: