Styles-related Features


Abstract class DefaultArrow provides support for the graphical decorations that can be placed at an edge's ends. Normally, this decoration is some kind of arrowhead that is used to indicate the edge's direction.

Figure 4.25. DefaultArrow


DefaultArrow makes available a number of predefined arrowhead renderings which can be directly used with the SourceArrow and TargetArrow properties defined in abstract class AbstractEdgeStyle. Example 4.26, “Setting arrows with an edge style” shows how to use the static Create methods from DefaultArrow to create arrows and set them as the decoration for the source and target ends of edges.

Figure 4.26. Different arrows at the source and target ends of an edge

Different arrows at the source and target ends of an edge.

Example 4.26. Setting arrows with an edge style

PolylineEdgeStyle pes = new PolylineEdgeStyle(Pens.Red);
pes.SourceArrow = DefaultArrow.Create(ArrowType.Circle, 
                                      Pens.Red, Brushes.Black, 0);
pes.TargetArrow = DefaultArrow.Create(ArrowType.Default);

The predefined arrows can be accessed by means of the enumerators defined in the ArrowType enumeration. The corresponding renderings are shown in Table 4.14, “Predefined arrowhead renderings”.

Note that omitting the decoration is done using ArrowType.None, which provides an empty "rendering."

Table 4.14. Predefined arrowhead renderings

Arrow Type Rendering

The Custom Styles tutorial shows how to create a custom arrowhead rendering using an IArrow implementation; see especially the steps 20 and 21.