work hard work smart

专注于Java后端开发。 不断总结,举一反三。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

WPF 小示例

Posted on 2011-08-31 15:38  work hard work smart  阅读(726)  评论(0编辑  收藏  举报

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();
  }

  效果图: