Paths are combination of lines, rectangles, simple curves, and other vector images. To draw a path you use the GraphicsPath object.
The following illustration shows a path created by combining a line, an arc, a Bézier spline, and a cardinal spline.
To draw a path, call the DrawPath method of the Graphics object. The Pen object is passed as an argument. The other argument is the GraphicsPath object.
The GraphicsPath class provides the following methods for creating a sequence of items to be drawn: AddLine, AddRectangle, AddEllipse, AddArc, AddPolygon, AddCurve (for cardinal splines), and AddBezier.
Below is the syntax of DrawPath method:
| DrawPath(ByVal pen As System.Drawing.Pen, ByVal path As System.Drawing.Drawing2D.GraphicsPath) |
The following code example shows how to draw a path that consists of a line, an ellipse, and a bezier spline: