Search
Shape Constructor (CreatePathDelegate, String)
See Also
 





Initializes a new instance of the Shape class with the specified outline formula and id.

Namespace: MindFusion.Diagramming.Wpf
Assembly: MindFusion.Diagramming.Wpf

 Syntax

C#  Copy Code

public Shape (
    CreatePathDelegate outlineDelegate,
    string id
)

Visual Basic  Copy Code

Public New ( _
    outlineDelegate As CreatePathDelegate, _
    id As String _
)

 Parameters

outlineDelegate
A delegate called to generate PathGeometry objects representing the shape outline.
id

The string identifier of the new shape.

 Example

This example creates a triangular shape:

C#  Copy Code
Shape shape = new Shape(CreatePath, "my shape");

PathGeometry CreatePath(ShapeData shapeData)
{
    var path = new PathGeometry();
    var fig = new PathFigure();
    fig.StartPoint = new Point(10, 0);
    fig.Segments.Add(new LineSegment(new Point(shapeData.Width, 10), true));
    fig.Segments.Add(new LineSegment(new Point(shapeData.Width / 2, shapeData.Height), true));
    fig.IsClosed = true;
    path.Figures.Add(fig);
    return path;
}

 See Also