Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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.StartFigure();
    myPath.AddLine(new Point(10, 10), new Point(150, 10));
    myPath.AddLine(new Point(150, 10), new Point(10, 150));
    myPath.StartFigure();
    myPath.AddArc(200, 200, 100, 100, 0, 90);
    myPath.StartFigure();
    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};
    myPath.AddCurve(points);

    // Close all the figures.
    myPath.CloseAllFigures();

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

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.