0

所以,我正在制作一个应用程序,我想逐渐(在几秒钟内)缩小图像控件,直到它消失。因此,我基本上将 ScaleTransform 与 DoubleAnimation 绑定在一起,但它会立即发生。这是我的代码:

DoubleAnimation anim = new DoubleAnimation(360, 0, (Duration)TimeSpan.FromSeconds(1));
ScaleTransform st = new ScaleTransform();

st.ScaleX = 0;
st.ScaleY = 0;
PACSCore.RenderTransform = st;
anim.Completed += (s, _) => Exit_PACS();
st.BeginAnimation(ScaleTransform.ScaleYProperty, anim);
4

1 回答 1

2

这应该可以解决问题:

DoubleAnimation anim = new DoubleAnimation(1, 0,(Duration)TimeSpan.FromSeconds(1));

ScaleTransform st = new ScaleTransform();
Control.RenderTransform = st;
st.BeginAnimation(ScaleTransform.ScaleXProperty, anim);
st.BeginAnimation(ScaleTransform.ScaleYProperty, anim);
于 2015-07-05T18:04:23.550 回答