Search
Diagram.DefaultShape Property
See Also
 





Gets or sets the default shape of shape nodes.

Namespace: MindFusion.Diagramming
Assembly: MindFusion.Diagramming

 Syntax

C#  Copy Code

public Shape DefaultShape { get; set; }

Visual Basic  Copy Code

Public Property DefaultShape As Shape

 Property Value

An instance of the Shape class. The default is the RoundRect shape.

 Remarks

The Shape property of newly created shape nodes is initialized with the value of this property. It defines a series of lines, arcs and curves composed in a complex shape. There are 87 predefined shapes exposed as static members of the Shape class. You can also define your own shapes as shown below.

 Example

The following example demonstrates how to create a custom shape and set it as a default in the diagram:

C#  Copy Code

private void example_Click(object sender, System.EventArgs e)
{
    // Define a custom shape
    // this is the same as: fc.DefaultShape = Shape.FromId("Tape");
    diagram.DefaultShape = new Shape(
        new ElementTemplate[] {
            new LineTemplate(50, 100, 85, 100),
            new LineTemplate(85, 100, 85, 90),
            new LineTemplate(85, 90, 70, 90),
            new BezierTemplate(70, 90, 85, 90, 100, 75, 100, 50),
            new BezierTemplate(100, 50, 100, 25, 75, 0, 50, 0),
            new BezierTemplate(50, 0, 25, 0, 0, 25, 0, 50),
            new BezierTemplate(0, 50, 0, 75, 25, 100, 50, 100) },
        FillMode.Winding);
}

Visual Basic  Copy Code

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

    ' Define a custom shape
    ' this is the same as: fc.DefaultShape = Shape.FromId("Tape")
    Diagram.DefaultShape = New Shape( _
        New ElementTemplate() { _
            New LineTemplate(50, 100, 85, 100), _
            New LineTemplate(85, 100, 85, 90), _
            New LineTemplate(85, 90, 70, 90), _
            New BezierTemplate(70, 90, 85, 90, 100, 75, 100, 50), _
            New BezierTemplate(100, 50, 100, 25, 75, 0, 50, 0), _
            New BezierTemplate(50, 0, 25, 0, 0, 25, 0, 50), _
            New BezierTemplate(0, 50, 0, 75, 25, 100, 50, 100)}, _
        FillMode.Winding)

End Sub

 See Also