0

我使用这个函数来旋转我的图像:

    public void rotateMe(Image img, double duration, int degrees, double xPoint, double yPoint)
    {
        Duration Time_duration = new Duration(TimeSpan.FromSeconds(duration));
        Storyboard MyStory = new Storyboard();
        MyStory.Duration = Time_duration;

        DoubleAnimation My_Double = new DoubleAnimation();
        My_Double.Duration = Time_duration;
        MyStory.Children.Add(My_Double);

        RotateTransform MyTransform = new RotateTransform();
        Storyboard.SetTarget(My_Double, MyTransform);
        Storyboard.SetTargetProperty(My_Double, new PropertyPath("Angle"));

        My_Double.To = degrees;
        img.RenderTransform = MyTransform;
        img.RenderTransformOrigin = new System.Windows.Point(xPoint, yPoint);

        MyStory.Begin();

        MyStory.Completed += new EventHandler(MyStory_Completed);
    }

问题是当我尝试再次向相反方向旋转时,它会旋转原始图像,而我想旋转新图像。

有任何想法吗?

4

0 回答 0