Polygon myPolygon = new Polygon(); myPolygon.AddVertex(new Point(0, 0)); myPolygon.AddVertex(new Point(0, 100)); myPolygon.AddVertex(new Point(100, 100)); myPolygon.AddVertex(new Point(100, 0)); myPolygon.AddVertex(new Point(50, 50)); // add a new vertex to the polygon
var poly = new Polygon(); poly.Points = new PointCollection { new Point(10,10), new Point(210,10), new Point(110,200) }; poly.AddVertex(new Point(150,150));In this example, we create a polygon object with three vertices using the PointCollection property. We then use the AddVertex method to add an additional vertex to the polygon, changing its shape to a quadrilateral. Package Library: The Polygon AddVertex method is part of the System.Windows.Shapes namespace, which is included in the PresentationFramework assembly.