<Window x:Class="simplewpf.chuantixx" Name="DW1"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         Title="chuantixx" Height="300" Width="300"  WindowStartupLocation="CenterScreen">           <Window.Resources>             <!--此样式能去除按钮点击后的虚线框-->             <Style x:Key="MyFocusVisual">                 <Setter Property="Control.Template">                     <Setter.Value>                         <ControlTemplate>                             <Rectangle Margin="-2" StrokeThickness="0" Stroke="Red" StrokeDashArray="1 2"/>                         </ControlTemplate>                     </Setter.Value>                 </Setter>             </Style>             <!--原始旋转出来样例-->             <Storyboard x:Key="showDW">                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="Opacity"                         From="0.2" To="1" Duration="0:0:2.5">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[1].Angle"                         From="70" To="0" Duration="0:0:2" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                         From="0" To="1" Duration="0:0:2"                         AccelerationRatio="1">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                         From="0" To="1" Duration="0:0:2"                         AccelerationRatio="1">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                         To="0.98" BeginTime="0:0:2" Duration="0:0:0.05"                         DecelerationRatio="1">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                         To="0.98" BeginTime="0:0:2" Duration="0:0:0.05"                         DecelerationRatio="1">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                         To="1" BeginTime="0:0:2.05" Duration="0:0:0.2"                          AccelerationRatio="1">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                                      Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                         To="1" BeginTime="0:0:2.05" Duration="0:0:0.2"                         AccelerationRatio="1">                 </DoubleAnimation>             </Storyboard>             <!--原始的旋转回去样例-->             <Storyboard x:Key="closeDW">                 <DoubleAnimation Storyboard.TargetName="Canvas1"                       Storyboard.TargetProperty="RenderTransform.Children[1].Angle"                       To="360" Duration="0:0:1.5" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                       Storyboard.TargetProperty="Opacity"                       To="0" Duration="0:0:3">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                       Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                       To="0" Duration="0:0:1.5" AccelerationRatio="1">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                       Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                       To="0" Duration="0:0:1.5" AccelerationRatio="1">                 </DoubleAnimation>             </Storyboard>             <!--转出来-->             <Storyboard x:Key="showDW1">                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="Opacity"                         From="0" To="1" Duration="0:0:0.2">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[1].Angle"                         From="180" To="0" Duration="0:0:0.2" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                         From="0.2" To="1" Duration="0:0:0.2"                         AccelerationRatio="1">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                         From="0.2" To="1" Duration="0:0:0.2"                         AccelerationRatio="1">                 </DoubleAnimation>             </Storyboard>             <!--弹出来-->             <Storyboard x:Key="showDW2">                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                         From="0.2" To="0.5" Duration="0:0:0.04" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                         From="0.2" To="0.5" Duration="0:0:0.04" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                           From="0.5" To="1" Duration="0:0:0.04" BeginTime="0:0:0.04" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                          From="0.5" To="1" Duration="0:0:0.04" BeginTime="0:0:0.04">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                          From="1" To="1.2" Duration="0:0:0.04" BeginTime="0:0:0.08" AutoReverse="True" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                         From="1"  To="1.2" Duration="0:0:0.04" BeginTime="0:0:0.08" AutoReverse="True">                 </DoubleAnimation>             </Storyboard>             <!--转回去-->             <Storyboard x:Key="closeDW1">                 <DoubleAnimation Storyboard.TargetName="Canvas1"                       Storyboard.TargetProperty="RenderTransform.Children[1].Angle"                       To="180" Duration="0:0:0.2" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                       Storyboard.TargetProperty="Opacity"                       To="0" Duration="0:0:0.2">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                       Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                       To="0.2" Duration="0:0:0.2" AccelerationRatio="1">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                       Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                       To="0.2" Duration="0:0:0.2" AccelerationRatio="1">                 </DoubleAnimation>             </Storyboard>

<!--弹回去-->             <Storyboard x:Key="closeDW2">                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                         From="1" To="1.2" Duration="0:0:0.04"  AutoReverse="True">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                         From="1" To="1.2" Duration="0:0:0.04"  AutoReverse="True">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                           From="1" To="0.5" Duration="0:0:0.04" BeginTime="0:0:0.04" >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                          From="1" To="0.5" Duration="0:0:0.04" BeginTime="0:0:0.04">                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX"                          From="0.5" To="0.2" Duration="0:0:0.04" BeginTime="0:0:0.08"  >                 </DoubleAnimation>                 <DoubleAnimation Storyboard.TargetName="Canvas1"                         Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY"                         From="0.5"  To="0.2" Duration="0:0:0.04" BeginTime="0:0:0.08" >                 </DoubleAnimation>             </Storyboard>         </Window.Resources>

<Window.Triggers>             <!--设置DW1的事件触发-->             <!--注意对窗体window的name取为DW1-->             <EventTrigger SourceName="DW1" RoutedEvent="Window.Loaded">                 <BeginStoryboard Name="showQueryCanvasStoryboard2"                       Storyboard="{StaticResource showDW}">                 </BeginStoryboard>             </EventTrigger>             <!--设置button1的事件触发-->             <!--注意对按钮的name取为button1-->             <EventTrigger SourceName="button1" RoutedEvent="Button.Click">                 <BeginStoryboard Name="closeQueryCanvasStoryboard"                       Storyboard="{StaticResource closeDW}">                 </BeginStoryboard>             </EventTrigger>         </Window.Triggers>

<Canvas Background="Transparent" Height="257" Width="214">             <Canvas Background="Brown" Height="236" Width="201" Canvas.Left="9" Canvas.Top="14" Name="Canvas1">                 <!--设置动画-->                 <Canvas.RenderTransform>                     <TransformGroup>                         <ScaleTransform CenterX="100" CenterY="50"></ScaleTransform>                         <!--缩放中心为100,50。RenderTransform.Children[0]-->                         <RotateTransform CenterX="100" CenterY="50"></RotateTransform>                         <!--旋转中心为100,50。RenderTransform.Children[1]-->                     </TransformGroup>                 </Canvas.RenderTransform>                 <Button Margin="98,107,124,127" Name="button1"  FocusVisualStyle="{DynamicResource MyFocusVisual}"                 Click="button1_Click"  Height="28" Width="112" Canvas.Left="-53" Canvas.Top="77">关闭</Button>                 <CheckBox Height="31" HorizontalAlignment="Left" Margin="32,25,0,0" Name="checkBox1" VerticalAlignment="Top" Width="75" Canvas.Left="11" Canvas.Top="-1">CheckBox</CheckBox>                 <TextBlock Height="35" Margin="124,21,34,0" Name="textBlock1" VerticalAlignment="Top" Background="BlueViolet" Text="dfdf" Width="60" Canvas.Left="-73" Canvas.Top="43" />             </Canvas>         </Canvas>

</Window>

private void button1_Click(object sender, RoutedEventArgs e)
        {   // this.Close();
            ///timer定义
            tm.Tick += new EventHandler(tm_Tick);
            tm.Interval = TimeSpan.FromSeconds(3);
            tm.Start();
        }
      //  using System.Windows.Threading;
        DispatcherTimer tm = new DispatcherTimer();
        void tm_Tick(object sender, EventArgs e)
        {
            this.Close();
        }

网摘 窗体的旋转效果 wpf的更多相关文章

  1. 关于WinForm引用WPF窗体---在Winform窗体中使用WPF控件

    项目中有个界面展示用WPF实现起来比较简单,并且能提供更酷炫的效果,但是在WinForm中使用WPF窗体出现了问题,在网上找了一下有些人说Winform不能引用WPF的窗体,我就很纳闷,Win32都能 ...

  2. Feedly订阅Blog部落格RSS网摘 - Blog透视镜

    网络信息爆炸的时代,如何更有效率地阅读文章,订阅RSS网摘,可以快速地浏览文章标题,当对某些文章有兴趣时,才点下连结连到原网站,阅读更详细的文章,Feedly Reader阅读器除了提供在线版订阅RS ...

  3. Bloglines订阅Blog部落格RSS网摘 - Blog透视镜

    网络信息蓬勃发展,Blog部落格越来越普及,如果逐一地去浏览网站,势必费时费力,倘若信息可以自己送上门,那就可以节省不少时间,就好像看报纸的标题,有兴趣才点连结,进到网站浏览文章内容,Blogline ...

  4. TCP/IP协议头部结构体(网摘小结)(转)

    源:TCP/IP协议头部结构体(网摘小结) TCP/IP协议头部结构体(转) 网络协议结构体定义 // i386 is little_endian. #ifndef LITTLE_ENDIAN #de ...

  5. Vim命令快捷键(网摘)

    Vim命令快捷键(网摘) 原文出处:[?---->home]

  6. winfrom窗体中嵌套WPF控件

    前言 本文主要介绍如何在winfrom窗体中嵌套WPF控件, 一来是自己记录一下,而来希望能对有需要的朋友提供实现思路. 如有错误请指出...下面进入正题... -1.前期准备 准备一个建立好的win ...

  7. c#与C++类型转换网摘

    转载自 C++和C#转换 https://www.cnblogs.com/zjoch/p/4147182.html c#与C++类型转换,网摘 //c++:HANDLE(void   *)       ...

  8. Delphi 中DataSnap技术网摘

    Delphi2010中DataSnap技术网摘 一.为DataSnap系统服务程序添加描述 这几天一直在研究Delphi 2010的DataSnap,感觉功能真是很强大,现在足有理由证明Delphi7 ...

  9. Python入门及容易!网摘分享给大家!

    Python:Python学习总结 背景 PHP的$和->让人输入的手疼(PHP确实非常简洁和强大,适合WEB编程),Ruby的#.@.@@也好不到哪里(OO人员最该学习的一门语言). Pyth ...

随机推荐

  1. matlab 中randn randi rand randsrc的用法以及区别

    1,rand 生成均匀分布的伪随机数.分布在(0~1)之间 主要语法:rand(m,n)生成m行n列的均匀分布的伪随机数                      rand(m,n,'double') ...

  2. iOS -- cocopods使用

  3. if -else 条件语句原理

    #!/usr/bin/python # coding utf-8 name = '?' if name == 'python': print('欢迎BOSS') else: print('输入错误')

  4. oracle操作记录

    由于之前建的job过多,造成数据库cpu占用率达到99%,造成需要的job崩溃. 以下为解决方案: 1. 查询当前的job列表 : select * from user_jobs; 2. 暂停所有的j ...

  5. 云平台 为什么推荐使用小VM 而不是大VM独占宿主机的方式部署游戏服?

    近期公司X游戏项目,提了一个游戏VM资源的需求,是 64GB RAM + 30Core CPU 的VM规格,而一个VM部署10个游戏服.而我们云平台推荐的VM规格为 4 Core CPU + 4GB ...

  6. [Google Guava]学习--新集合类型Multiset

    Guava提供了一个新集合类型Multiset,它可以多次添加相等的元素,且和元素顺序无关.Multiset继承于JDK的Cllection接口,而不是Set接口. Multiset主要方法介绍: a ...

  7. idea 新建web项目

  8. 【HDU 2089】不要62

    http://acm.hdu.edu.cn/showproblem.php?pid=2089 数位dp,参照了打野的博客 预处理出f数组,f[i][j]表示第i位为数字j时的可行的数字总数. 对于区间 ...

  9. ios审核要注意的地方(转)

    磨刀不误砍柴工.作为手机应用开发者,你需要向应用商店提交应用审核,迅速通过审核可以让你抢占先机.对苹果iOS应用开发者来说尤其如此.苹果应用商店的审核近乎吹毛求疵,下面这些清单可以让你知道苹果会在哪些 ...

  10. 使用事件捕获实时捕获img是否加载完毕, 实现iframe内容高度自动适应

    如何判断在html中图片加载完毕呢? 给img图片加onload事件呗. 如何判断一个界面中所有的图片加载完毕呢? 给所有的图片加上onload事件呗. 如果有1000张图片那要怎么绑定事件呢? 我们 ...