窗口动画运行不顺畅

时间:2014-05-11 17:21:30

标签: c# wpf

我正在使用WPF在C#中编写应用程序,我希望在按钮单击事件后添加调整大小窗口动画。我的问题是动画运行不如预期的那样平滑。在一个空的应用程序上一切都很好。

double final = 800.0;
double initial = 223.0;

DoubleAnimation animation = new DoubleAnimation();
animation.Duration = TimeSpan.FromSeconds(1);
animation.To = final;
if (this.Width == final) { animation.To = initial; }

this.BeginAnimation(Window.WidthProperty, animation);

如何让动画顺利运行?

0 个答案:

没有答案
相关问题