1
Reply

How to Move An Ellipse in Wpf Using Canvas in some Angle??

Murali Reddy

Murali Reddy

11y
2.6k
0
Reply

    First Findout the Canvas.Left and Canvas.Top properties of ellipse which we r gonna move.

    int x=0;
    timer_tick(sender,e)
    {
    double left=Canvas.getLeft(ellipse1);
    double top=Canvas.getTop(ellipse1);

     double a = Math.Cos((angle - x) * (Math.PI / 180));
                        x = x + 5;
                        ellipse1.SetValue(Canvas.LeftProperty, left + 20);
                        ellipse1.SetValue(Canvas.TopProperty, top - (20 * a));
    }