I have a program that I can drag, rotate and resize a System.Windows.Shapes.Ellipse
in a Canvas
panel.
To resize and drag the ellipse inside the canvas and always keep it center I need to correct every time its origin, because the ellipse has it origin in the top left corner.
Have a way to make the origin in the Ellipse
on center by default?
Drag:
Canvas.SetTop(ellipse, newX - (ellipse.Height / 2));
Canvas.SetLeft(ellipse, newY - (ellipse.Width / 2));
Resize:
ellipse.Height = newHeight;
ellipse.Width = newWidth;
Rotate:
ellipse.RenderTransform = new RotateTransform(angle,(ellipse.Width/2),(ellipse.Height/2));