Export (0) Print
Expand All

ShapeGeometry.GetPath Method (RectangleD)

Gets the path around the shape geometry.

Namespace:  Microsoft.VisualStudio.Modeling.Diagrams
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.12.0.dll)

protected virtual GraphicsPath GetPath(
	RectangleD boundingBox
)

Parameters

boundingBox
Type: Microsoft.VisualStudio.Modeling.Diagrams.RectangleD

The bounding box for the shape or link, relative to the top-left corner of the shape’s parent.

Return Value

Type: System.Drawing.Drawing2D.GraphicsPath
The path around the shape geometry.

This property returns a reference to the path used by this geometry. Do not dispose it. Use the path before using GetPath() again. If you require a copy, use GetPathCopy.

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:
© 2015 Microsoft