/winforms-diagram-create-custom-shapes-with-connection-points

Define custom shapes for the DiagramControl in XML.

Primary LanguageVisual Basic .NETOtherNOASSERTION

Diagram Control for WinForms - Create Custom Shapes with Connection Points

This example demonstrates how to define custom shapes for the DiagramControl in XML.

image

The ShapeTemplate class describes a diagram shape and contains the following segments:

  • Start - Specifies the start point of the geometry and includes customization properties. A shape can consist of multiple geometries.
  • Line - Defines a line with start and end points.
  • Arc - Defines an arc with size and direction.
  • ShapePoint - Defines a connection point. To specify connection points, use the ShapeTemplate.ConnectionPoints property.
  • Parameter - Defines a parameter that allows users to transform the shape. To specify parameters, use the ShapeTemplate.Parameters property.

Refer to the following help topic for more information about supported segments: Creating Shapes and Containers Using Shape Templates.

To register custom shapes, create a stencil with the DiagramStencil.Create method and pass it to the DiagramToolboxRegistrator.RegisterStencil method.

To create a shape in code, get an instance of your custom stencil, call the DiagramStencil.GetShape method to access the ShapeDescription object, and assign it to the DiagramShape.Shape property:

new DiagramShape() { Shape = customStencil.GetShape("Shape1")}

Files to Look At

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)