Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

GraphicsPath.CloseAllFigures Method

Closes all open figures in this path and starts a new figure. It closes each open figure by connecting a line from its endpoint to its starting point.

Namespace:  System.Drawing.Drawing2D
Assembly:  System.Drawing (in System.Drawing.dll)

public void CloseAllFigures()

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an OnPaint event object. The code performs the following actions:

  • Creates a path.

  • Adds several open figures to the path.

  • Closes all figures in the path.

  • Draws the path to the screen.

private void CloseAllFiguresExample(PaintEventArgs e)

    // Create a path containing several open-ended figures.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddLine(new Point(10, 10), new Point(150, 10));
    myPath.AddLine(new Point(150, 10), new Point(10, 150));
    myPath.AddArc(200, 200, 100, 100, 0, 90);
    Point point1 = new Point(300, 300);
    Point point2 = new Point(400, 325);
    Point point3 = new Point(400, 375);
    Point point4 = new Point(300, 400);
    Point[] points = {point1, point2, point3, point4};

    // Close all the figures.

    // Draw the path to the screen.
    e.Graphics.DrawPath(new Pen(Color.Black, 3), myPath);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft