Export (0) Print
Expand All

GraphicsPath::StartFigure Method

Starts a new figure without closing the current figure. All subsequent points added to the path are added to this new figure.

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

public:
void StartFigure()

The user must keep the original points if they are needed. The original points are converted to cubic Bézier control points internally, therefore there is no mechanism for returning the original points.

This method starts a new subpath in the path. Subpaths allow you to separate a path into sections and use the GraphicsPathIterator class to iterate through the subpaths.

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 two sets of figures. The first set of figures combines four primitives into two figures. The second set of figures combines the same four primitives (except that they are offset in the y-axis) into three figures.

  • Draws all the figures to the screen.

Notice the difference in the appearance between the two sets of figures.

public:
   void StartFigureExample( PaintEventArgs^ e )
   {
      // Create a GraphicsPath object.
      GraphicsPath^ myPath = gcnew GraphicsPath;

      // First set of figures.
      myPath->StartFigure();
      myPath->AddArc( 10, 10, 50, 50, 0, 270 );
      myPath->AddLine( Point(50,0), Point(100,50) );
      myPath->AddArc( 50, 100, 75, 75, 0, 270 );
      myPath->CloseFigure();
      myPath->StartFigure();
      myPath->AddArc( 100, 10, 50, 50, 0, 270 );

      // Second set of figures.
      myPath->StartFigure();
      myPath->AddArc( 10, 200, 50, 50, 0, 270 );
      myPath->CloseFigure();
      myPath->StartFigure();
      myPath->AddLine( Point(60,200), Point(110,250) );
      myPath->AddArc( 50, 300, 75, 75, 0, 270 );
      myPath->CloseFigure();
      myPath->StartFigure();
      myPath->AddArc( 100, 200, 50, 50, 0, 270 );

      // Draw the path to the screen.
      e->Graphics->DrawPath( gcnew Pen( Color::Black ), myPath );
   }
   // End StartFigureExample

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.

Show:
© 2014 Microsoft