问题描述
我有几个与同一类事情有关的未决问题,
I have a couple of open questions relating to the same sort of thing,
我对 WPF 很陌生,但对 C# 和 Winforms 很有经验.
I am quite new to WPF but experienced with C# and Winforms.
我在互联网上四处寻找一个可行的示例,但还没有找到一个可行的示例.
I have looked around on the interweb for a working example but have yet to find one that works.
我想要实现的是在 C# 函数中创建以下内容
What I want to achieve is in a C# function create the following
- 创建图像(图像 1)
- 创建图片(图片 2)
- 将图像并排放置在窗口中
- 创建故事板
- 将 image1 的旋转属性设置为 0 到 360 度的动画(动画 1)
- 将图像 2 的不透明度属性从完全变为不可见(动画 2)
- 故事板应该运行十秒钟,动画 1 开始0 秒,动画 2 从 5 秒开始
对代码的明确请求表示歉意,但是,我已经查看并尝试过,我之前的问题有完整的代码已执行但没有显示动画(下面的链接)
apologies for the explicit request for code, but, I have looked, and tried, my previous question had full code that executed but no animation showed (link below)
如何使用 c# 代码在 wpf 中创建故事板和旋转图像
提前致谢
丹.
推荐答案
这是您问题的有效 XAML 版本,后跟 C# 中的相同内容.可能不完全是你所追求的,但它应该说明它.
Here is a working XAML versionn of your question followed by the identical thing in C#. May not be exactly what you were after, but it should illustrate it.
XAML 版本:
和C#版本:
这篇关于如何仅使用 c# 代码在图像对象上创建旋转动画(在 WPF 窗口内)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!