时间:2016年05月18日 | 作者 : aaronyang | 分类 : WPF | 浏览: 2330次 | 评论 0 人
private void btnInstant_Click(object sender, RoutedEventArgs e) { var scaler = mainPanel.LayoutTransform as ScaleTransform; if (scaler == null) { // Currently no zoom, so go instantly to max zoom. mainPanel.LayoutTransform = new ScaleTransform(1.5, 1.5); } else { double curZoomFactor = scaler.ScaleX; // If the current ScaleX and ScaleY properties were set by animation, // we'll have to remove the animation before we can explicitly set // them to "local" values. if (scaler.HasAnimatedProperties) { // Remove the animation by assigning a null // AnimationTimeline to the properties. // Note that this causes them to revert to // their most recently assigned "local" values. scaler.BeginAnimation(ScaleTransform.ScaleXProperty, null); scaler.BeginAnimation(ScaleTransform.ScaleYProperty, null); } if (curZoomFactor == 1.0) { scaler.ScaleX = 1.5; scaler.ScaleY = 1.5; } else { scaler.ScaleX = 1.0; scaler.ScaleY = 1.0; } } }
private void btnAnimate_Click(object sender, RoutedEventArgs e) { // We may have already set the LayoutTransform to a ScaleTransform. // If not, do so now. var scaler = mainPanel.LayoutTransform as ScaleTransform; if (scaler == null) { scaler = new ScaleTransform(1.0, 1.0); mainPanel.LayoutTransform = scaler; } // We'll need a DoubleAnimation object to drive // the ScaleX and ScaleY properties. DoubleAnimation animator = new DoubleAnimation() { Duration = new Duration(TimeSpan.FromMilliseconds(600)), }; // Toggle the scale between 1.0 and 1.5. if (scaler.ScaleX == 1.0) { animator.To = 1.5; } else { animator.To = 1.0; } scaler.BeginAnimation(ScaleTransform.ScaleXProperty, animator); scaler.BeginAnimation(ScaleTransform.ScaleYProperty, animator); }
推荐您阅读更多有关于“WPF4.5,”的文章
合肥科大智能常年招聘C# .NET CORE,vue前端,JAVA开发,有想换工作的私聊我和AY交流
抖音号:wpfui,可以看到我的很多作品效果,私活合作请qq联系我
AYUI8社区版Github地址:前往获取
作者:杨洋(AaronYang简称AY,安徽六安人)目前是个人,还没公司和AY交流
高中学历,2015年1月17日开始,兴趣学习研究WPF,目前工作繁忙,不接任何活
声明:AYUI7个人与商用免费,源码可购买。部分DEMO不免费.AY主要靠卖技术服务挣钱
不是从我处购买的ayui7源码,我不提供任何技术服务,如果你举报从哪里买的,我可以帮你转正为我的客户,并送demo
查看捐赠AYUI7.X MVC教程 更新如下:
第一课 第二课 程序加密教程vs2015 企业版密钥HM6NR-QXX7C-DFW2Y-8B82K-WTYJV
vs2017 企业版密钥NJVYC-BMHX2-G77MM-4XJMR-6Q8QF
额 本文暂时没人评论 来添加一个吧
发表评论