private void moveTo(Point deskPoint, Control ell, double space)
//deskPoint: 控件要移动到的位置 , ell :你要移动的空间 , space : 设置移动的时间片(关系到控件移动的速度)
{Point curPoint = new Point();
curPoint.X = Canvas.GetLeft(ell);
curPoint.Y = Canvas.GetTop(ell);
double lxspeed = space, lyspeed = space; //设置X方向 / Y方向 移动时间片
//创建X轴方向动画
DoubleAnimation doubleAnimation = new DoubleAnimation(Canvas.GetLeft(ell),
deskPoint.X,
new Duration(TimeSpan.FromMilliseconds(lxspeed))
);
Storyboard.SetTarget(doubleAnimation, ell);
Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Left)"));