Implements algorithms for arranging tree structures.
C#
![]() |
---|
public class TreeLayout : __ComObject, ITreeLayout, TreeLayout |
Visual Basic
![]() |
---|
Public Class TreeLayout |
VB6
![]() |
---|
Public Class TreeLayout |
C++
![]() |
---|
class TreeLayout |
To apply a tree layout to the flowchart, create a TreeLayout instance, set its members and pass it to the ArrangeDiagram method. Set the Type property of a TreeLayout instance to select which tree layout algorithm to run.
As long as the underlying graph is a tree, the algorithm can find the root node automatically. You can override it by setting the Root property, e.g. in order to arrange only a selected branch of the tree. The distance between the root and the second level and between all subsequent levels can be set through the LevelSpacing property. The distance between adjacent nodes in the same level is set through NodeSpacing.
In addition to arranging the tree nodes, TreeLayout also sets the shape of links as set through its ArrowStyle property. Anchoring specifies whether the links should be attached to the anchor points of tree nodes. Note that links that are not part of the tree are ignored, e.g. graph links that go in opposite direction of the general parent-to-child flow or cross-links that connect different tree branches. The tree layout algorithm produces best results if it can place link ends at arbitrary positions over nodes' outlines, that is, when using the ancIgnore value. If your application logic requires links to be always attached to anchor points, use the other two values. In such cases ancReassign would yield better results. You can post-process such links after calling ArrangeDiagram, for example by setting their ControlPoints coordinates or by calling their Route method.
By default, the order of child nodes arranged under a parent corresponds to the order of links in the parent's OutgoingArrows collection. Set the PreserveOrder property to keep the original geometric order of child nodes when arranging them under their parent. This can be used to arrange tree branches in a specific order by first placing them in increasing horizontal or vertical positions. Another possibility is to apply TreeLayout from ObjectModified handler to let users rearrange the tree branches by dragging and dropping a node.