3
Answers

Resize the polygon by programmatically..

nanda kishor

nanda kishor

7y
257
1
Here I have code to draw the polygon, it is working fine..
 
private void DrawTriangle(bool fill)
{
var pointsCollection = new PointCollection();
pointsCollection.Add(new Point(10, 4));
pointsCollection.Add(new Point(5, 12));
pointsCollection.Add(new Point(15, 12));
pointsCollection.Add(new Point(10, 4));
var triangle = new Polygon
{
Points = pointsCollection,
Stroke = brush
};
if (fill)
triangle.Fill = brush;
canvas.Children.Add(triangle);
}
 
I need to resize the polygon, so I am using scaletransform to resize it.
 
ScaleTransform scaleTransform1 = new ScaleTransform(scalex, scaley);
triangle.RenderTransform = scaleTransform1;
 
but the transformation is not working here..
 
Answers (3)