Find Polygon Coordinates WP7
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 transf开发者_高级运维ormation?
Thanks for your help.
Read this...
Get element position after transform
You'll have to apply the transforms by yourself to find out the coordinates after transformation.
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.
精彩评论