Share via


ShapeGeometry.GetPath Method

Include Protected Members
Include Inherited Members

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.

Overload List

  Name Description
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

Examples

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;
}

See Also

Reference

ShapeGeometry Class

Microsoft.VisualStudio.Modeling.Diagrams Namespace