在没加入到Canvas时,也能获取形状的方法: var polygon = new Polygon(); polygon.Points.Add(new Point(xStart, yStart)); polygon.Points.Add(new Point(xEnd, yStart)); polygon.Points.Add(new Point(xEnd, yEnd)); polygon.Points.Add(new Point(xStart, yEnd)); polygon.Arrange(n…