本文介绍了使用WPF故事板正向和反向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要帮助的故事板中寻找。下面code不工作:
I need help in the Storyboard Seek. The following code is not working:
Storyboard StoryBoard;
public void Reverse()
{
StoryBoard.Pause(this);
TimeSpan ts = new TimeSpan(0);
ts.Subtract(TimeSpan.FromMilliseconds(1000));
StoryBoard.Seek(this, ts, TimeSeekOrigin.BeginTime);
}
public void Forward()
{
StoryBoard.Pause(this);
TimeSpan ts = new TimeSpan(0);
ts.Add(TimeSpan.FromMilliseconds(1000));
StoryBoard.Seek(this, ts, TimeSeekOrigin.BeginTime);
}
先谢谢了。
推荐答案
对于反转:
TimeSpan CurrentTime = (TimeSpan) StoryBoard.CurrentTime;
TimeSpan SubtractTime = CurrentTime.Subtract(new TimeSpan(FrameRate * (long)Math.Pow(10,4)));
StoryBoard.Seek(SubtractTime, TimeSeekOrigin.Duration);
正向:
TimeSpan CurrentTime = (TimeSpan) StoryBoard.CurrentTime;
TimeSpan AddTime = CurrentTime.Add(new TimeSpan(FrameRate * (long)Math.Pow(10,4)));
StoryBoard.Seek(AddTime, TimeSeekOrigin.Duration);
这篇关于使用WPF故事板正向和反向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!