日期:2014-05-17  浏览次数:20942 次

怎么实现窗体的左右摆动 下面的代码能实现向右摆动
 public void move()
        {
            RotateTransform rt = new RotateTransform();
            msg.RenderTransform = rt;

            DoubleAnimation da = new DoubleAnimation(-4, 4, new Duration  (TimeSpan.FromSeconds(0.8)));
            Storyboard storyboard = new Storyboard();
            da.RepeatBehavior = RepeatBehavior.Forever;
            storyboard.Children.Add(da);
            Storyboard.SetTarget(da, msg);
            Storyboard.SetTargetProperty(da, new PropertyPath("RenderTransform.Angle"));
            storyboard.Begin();
}

msg 窗体的名字
C# wpf 窗体摆动

------解决方案--------------------
Storyboard.SetTargetProperty(da, new PropertyPath(Canvas.LeftProperty));
------解决方案--------------------
http://hi.baidu.com/wunianbin/item/dd798029c78a75ff50fd8795