zoukankan
html css js c++ java
WPF中连续旋转时角度错误的问题
<
Window
x:Class
="ImageZoomTest.Window1"
xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
WindowState
="Maximized"
>
<
Grid
Margin
="0"
Name
="gridMain"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
="0.7*"
/>
<
ColumnDefinition
Width
="0.3*"
/>
</
Grid.ColumnDefinitions
>
<
DockPanel
Grid.Column
="0"
>
<
Image
Name
="imageLarge"
Source
="Image\1600XMAS_3001.jpg"
Width
="800"
Height
="500"
>
<
Image.RenderTransform
>
<
RotateTransform
x:Name
="imageLargeRotateTransform"
Angle
="0"
/>
</
Image.RenderTransform
>
</
Image
>
</
DockPanel
>
<
DockPanel
Grid.Column
="1"
>
<
Button
Name
="btnRotateClockwise"
Content
="Rotate clockWise"
DockPanel.Dock
="Bottom"
>
<
Button.Triggers
>
<
EventTrigger
RoutedEvent
="Button.Click"
>
<
BeginStoryboard
>
<
Storyboard
>
<
DoubleAnimation
Storyboard.TargetName
="imageLargeRotateTransform"
Storyboard.TargetProperty
="Angle"
By
="90"
Duration
="0:0:1"
/>
</
Storyboard
>
</
BeginStoryboard
>
</
EventTrigger
>
</
Button.Triggers
>
</
Button
>
</
DockPanel
>
</
Grid
>
</
Window
>
上面这段代码的效果是点击一下button,图片顺时针旋转90度,动画时间是1秒针。如果点击按钮时候比较慢,两次点击的间隔大于1秒,运行正常。但是如果点击的很快,第一次点击的动画还没有结束,第二次点击的动画又开始了,图片最后停止时停留的角度就有问题了。
解决这种现象的方法很简单,只要在BeginStoryboard里面设置HandoffBehavior属性为Compose就可以了:
<BeginStoryboard HandoffBehavior ="Compose" >。
查看全文
相关阅读:
微信小程序 解决disableScroll无法禁止小程序下拉的问题和视频铺满全屏尺寸
微信小程序无法获取手机号 error:改appid没有权限
js localeCompare() 根据汉字首字母进行排序
vue 引入本地JS中的json 数据解析
vue 打包优化 外部资源 elementUI axios等引入
vue中 高德地图获取定位
vue 与qrcodejs2 生成的二维码 logo 居中
Mac vue-cli2.x版本升级3.x方法
微信小程序 cover-view在 Video(原生组件)中遇到的问题
Mac安装Vue-cli时 提示bash: vue: command not found问题
原文地址:https://www.cnblogs.com/pdfw/p/1154725.html
最新文章
Js-面向对象
移动端导航返回按钮事件
完美解决 fatal: unable to access 'https://github.com/.../.git': Could not resolve host: github.com
VS Code配置
vue-cli 安装
java 数据类型
java 方法使用
Java 中的方法
java 数组
java 导入包
热门文章
初识Java
coursera课程《how to learning 怎么学习》 总结
将近 30 岁程序员所思所想
前端该怎么引入模块文件
逻辑思维-时间的朋友-2018-跨年演讲总结
vscode c 语言 win10
《何为良好生活》
NPM
前端的焦虑
apicloud 开发环境搭建
Copyright © 2011-2022 走看看