Reputation: 31
After doing rotating and translating using CompositeTransform. The coordinates for the shapes remain the same in both messagebox.
Messagebox.Show(Convert.ToString(T1Shape.Points[i].X)) ;
initialAngle = transform.Rotation;
initialScale = transform.ScaleX;
transform.TranslateY = -150;
transform.TranslateX = 200;
Messagebox.Show(Convert.ToString(T1Shape.Points[i].X)) ;
How do i find out the coordinates of the polygon on the canvas or after transformation?
Thanks for your help.
Upvotes: 3
Views: 496
Reputation: 69372
You simply get the position of the UIElement relative to 0,0
(assuming you want the standard positions). The translation position is only relative to itself and won't bring back the new position of the polygon itself. Therefore, this should do it:
var gtransform = myPolygon.TransformToVisual(Application.Current.RootVisual as UIElement);
Point position = gtransform.Transform(new Point(0, 0));
You can then use position.X
and position.Y
to get the X and Y positions respectively.
Upvotes: 0
Reputation: 50672
You'll have to apply the transforms by yourself to find out the coordinates after transformation.
Upvotes: 0