Draws a GraphicsPath object.
[Visual Basic]
Public Sub DrawPath( _
ByVal pen As Pen, _
ByVal path As GraphicsPath _
)
[C#]
public void DrawPath(
Pen pen,
GraphicsPath path
);
[C++]
public: void DrawPath(
Pen* pen,
GraphicsPath* path
);
[JScript]
public function DrawPath(
pen : Pen,
path : GraphicsPath
);
Parameters
- pen
- Pen object that determines the color, width, and style of the path.
- path
- GraphicsPath object to draw.
Return Value
This method does not return a value.
Remarks
The current transformation in the graphic context is applied to the GraphicsPath object before it is drawn.
Example
[Visual Basic, C#] The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:
- Creates a graphics path object and adds an ellipse to it.
- Creates a black pen.
- Draws the graphics path to the screen.
[Visual Basic]
Public Sub DrawPathEllipse(e As PaintEventArgs)
' Create graphics path object and add ellipse.
Dim graphPath As New GraphicsPath()
graphPath.AddEllipse(0, 0, 200, 100)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Draw graphics path to screen.
e.Graphics.DrawPath(blackPen, graphPath)
End Sub
[C#]
public void DrawPathEllipse(PaintEventArgs e)
{
// Create graphics path object and add ellipse.
GraphicsPath graphPath = new GraphicsPath();
graphPath.AddEllipse(0, 0, 200, 100);
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Draw graphics path to screen.
e.Graphics.DrawPath(blackPen, graphPath);
}
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
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
Graphics Class | Graphics Members | System.Drawing Namespace