We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

ShapeGeometry.GetPath Method

Gets the path around the shape geometry. Use the returned path before applying GetPath() to any other shape. Use GetPathCopy() if you want to retain a path.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method GetPath(IGeometryHost) Gets the path around the shape geometry. Use the returned path before applying GetPath() to any other shape. Use GetPathCopy() if you want to retain a path.
Protected method GetPath(RectangleD) Gets the path around the shape geometry.
Top

This example is for a circular shape. Notice that UninitializedPath is used and reset.

/// <summary>
/// Gets the GraphicsPath of the geometry.
/// Returns a reference to the path - do not dispose it.
/// </summary>
/// <param name="boundingBox">The bounding box of the shape.</param>
/// <returns>The GraphicsPath of the geometry.</returns>
protected override GraphicsPath GetPath(RectangleD boundingBox)
{
GraphicsPath path = UninitializedPath;
path.Reset();

path.AddEllipse((float)boundingBox.X, (float)boundingBox.Y, (float)boundingBox.Width, (float)boundingBox.Height);
return path;
}
Show: