ASP.NET Pack Programmer's Guide
ShapeNode.Shape Property
See Also
 





Gets or sets a reference to the node's geometric shape definition.

Namespace: MindFusion.Diagramming
Package: MindFusion.Diagramming

 Syntax

C#  Copy Code

public Shape Shape { get; set; }

Visual Basic  Copy Code

Public Property Shape As Shape

 Property Value

An instance of the Shape class.

 Remarks

Use this property to assign a complex shape to a node. Complex shapes consist of outlines, decorations and text-region definitions that can be defined as series of lines, arcs and curves. To define a custom shape, create an instance of the Shape class. That class also provides 87 predefined shapes exposed by the Shapes collection.

 Example

The following sample code illustrates how to use the predefined shapes and how to create your own custom shapes.

C#  Copy Code

private void example_Click(object sender, System.EventArgs e)
{
    ShapeNode shapeNode0 = diagram.Nodes[0] as ShapeNode;
    ShapeNode shapeNode1 = diagram.Nodes[1] as ShapeNode;

    // Use one of the predefined shapes
    shapeNode0.Shape = Shape.FromId("MultiDocument");

    // Create a custom shape
    shapeNode1.Shape = new Shape(
        new ElementTemplate[] {
            new LineTemplate(0, 100, 60, 100),
            new BezierTemplate(60, 100, 80, 100, 100, 75, 100, 50),
            new BezierTemplate(100, 50, 100, 25, 80, 0,  60, 0),
            new LineTemplate(60, 0, 0, 0),
            new LineTemplate(0, 0, 0, 100) },
        FillMode.Winding);
}

Visual Basic  Copy Code

Private Sub example_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles example.Click

    Dim shapeNode0 As ShapeNode = CType(diagram.Nodes(0), ShapeNode)
    Dim shapeNode1 As ShapeNode = CType(diagram.Nodes(1), ShapeNode)

    ' Use one of the predefined shapes
    shapeNode0.Shape = Shape.FromId("MultiDocument")

    ' Create a custom shape
    shapeNode1.Shape = New Shape( _
        New ElementTemplate() { _
            New LineTemplate(0, 100, 60, 100), _
            New BezierTemplate(60, 100, 80, 100, 100, 75, 100, 50), _
            New BezierTemplate(100, 50, 100, 25, 80, 0, 60, 0), _
            New LineTemplate(60, 0, 0, 0), _
            New LineTemplate(0, 0, 0, 100)}, _
        FillMode.Winding)

End Sub

 See Also

ShapeNode Members
ShapeNode Class
MindFusion.Diagramming Namespace
Shape.FromId Method
Shape.Shapes Property
PolygonalTextLayout Property
ShapeOrientation Property
AllowFlip Property