An instance of this class represents a shape defined through a series of arc, line and Bezier segments. The segments can be a part of the shape outline, in which case they define the part of the shape is filled, used for hit-testing and for aligning links to the node edges. Segments can also be added as decoration elements, in which case they only affect the appearance of a ShapeNode.
Namespace: MindFusion.Diagramming
Assembly: MindFusion.Diagramming
C#
![]() |
---|
public class Shape |
Visual Basic
![]() |
---|
Public Class Shape |
The Shape class provides the means for defining complex node shapes. With its help you can design any shape composed of lines, arcs and Bézier-curves. A shape template should contain an outline to be used for hit testing, clipping and finding intersections with other items. If the outline is not defined, the rectangle specified by the Bounds property of nodes is used for hit-testing.
MindFusion.Diagramming provides a set of over 100 predefined shape templates accessible through the static Shapes collection and the FromId method of Shape. A shape template can be applied to a node by assigning it to the Shape property of shape nodes. The predefined shapes are also exposed as properties of the Shapes class.
There are several Shape constructor overrides you might choose from, depending on the complexity of the shapes you want to create. They take arrays of ElementTemplate objects as arguments, which define the outline, decorations and text region definitions. Templates are described with coordinates expressed as percents of a shape node's area.
The ShapeDesigner tool included in the MindFusion.Diagramming suite lets you draw custom shapes and store them in shape libraries. A library file can be loaded into your application using the ShapeLibrary class. The definitions loaded from a shape library are automatically added to the Shapes collection and can be accessed through the FromId method, just as the predefined shapes.
Here is how the DirectAccessStorage shape is defined in the MindFusion.Diagramming source code:
C#
![]() |
---|
new Shape( new ElementTemplate[] { new LineTemplate(10, 0, 90, 0), new ArcTemplate(80, 0, 20, 100, -90, 180), new LineTemplate(90, 100, 10, 100), new ArcTemplate(0, 0, 20, 100, 90, 180) }, new ElementTemplate[] { new ArcTemplate(0, 0, 20, 100, -90, 180) }, new ElementTemplate[] { new LineTemplate(10, 0, 90, 0), new ArcTemplate(80, 0, 20, 100, -90, 180), new LineTemplate(90, 100, 10, 100), new BezierTemplate(10, 100, 35, 66, 35, 33, 10, 0) }, fill, "DirectAccessStorage"); |
Visual Basic
![]() |
---|
New Shape( _ New ElementTemplate() _ { _ New LineTemplate(10, 0, 90, 0), _ New ArcTemplate(80, 0, 20, 100, -90, 180), _ New LineTemplate(90, 100, 10, 100), _ New ArcTemplate(0, 0, 20, 100, 90, 180) _ }, _ New ElementTemplate() _ { _ New ArcTemplate(0, 0, 20, 100, -90, 180) _ }, _ New ElementTemplate() _ { _ New LineTemplate(10, 0, 90, 0), _ New ArcTemplate(80, 0, 20, 100, -90, 180), _ New LineTemplate(90, 100, 10, 100), _ New BezierTemplate(10, 100, 35, 66, 35, 33, 10, 0) _ }, _ FillMode.Winding, "DirectAccessStorage") |
System.Object
MindFusion.Diagramming.Shape