I need to find out the new coordinates of the line after rotation using the RotateTransform method on the line.
For example, after this line:
line.RenderTransform = new RotateTransform(25, 0, 0);
line.X1and three other properties do not change. I found some solution for shapes like rectangular, but it does not work for the line. The line has a different treatment.
EDIT: Thanks for your help HB . The second way is exactly what I was looking for.
DECISION:
Line line = new Line();
line.X1 = 10;
line.Y1 = 10;
line.X2 = 20;
line.Y2 = 30;
RotateTransform rotation = new RotateTransform();
Point p1 = rotation.Transform(new Point(line.X1, line.Y1));
Point p2 = rotation.Transform(new Point(line.X2, line.Y2));
line.X1 = p1.X;
line.Y1 = p1.Y;
line.X2 = p2.X;
line.Y2 = p2.Y;
This code rotates the line and sets the new coordinate values to the attached properties of this line.
source
share