This documentation is archived and is not being maintained.

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.

[Visual Basic]
Public Sub StartFigure()
[C#]
public void StartFigure();
[C++]
public: void StartFigure();
[JScript]
public function StartFigure();

Remarks

The user must keep the original points if they are needed. The original points are converted to cubic Bzier 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.

Example

[Visual Basic, C#] The following 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.

[Visual Basic, C#] Notice the difference in the appearance between the two sets of figures.

[Visual Basic] 
Public Sub StartFigureExample(e As PaintEventArgs)
' Create a GraphicsPath object.
Dim myPath As New GraphicsPath()
' First set of figures.
myPath.StartFigure()
myPath.AddArc(10, 10, 50, 50, 0, 270)
myPath.AddLine(New Point(50, 0), New 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(New Point(60, 200), New 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(New Pen(Color.Black), myPath)
End Sub
        
[C#] 
public void StartFigureExample(PaintEventArgs e)
{
// Create a GraphicsPath object.
GraphicsPath myPath = new GraphicsPath();
// First set of figures.
myPath.StartFigure();
myPath.AddArc(10, 10, 50, 50, 0, 270);
myPath.AddLine(new Point(50, 0), new 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(new Point(60, 200), new 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(new Pen(Color.Black), myPath);
} // End StartFigureExample
        

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

GraphicsPath Class | GraphicsPath Members | System.Drawing.Drawing2D Namespace

Show: