Search
Using Automatic Layout Algorithms

Applying TreeLayout algorithm to rearrange the diagram

  1. Initialize a new instance of the TreeLayout class.

C#  Copy Code

TreeLayout tl = new TreeLayout();

  1. Set Type, Direction and LinkStyle of the TreeLayout.

C#  Copy Code

tl.Type = TreeLayoutType.Centered;
tl.Direction = TreeLayoutDirection.TopToBottom;
tl.LinkStyle = TreeLayoutLinkType.Cascading3;

  1. Specify NodeDistance, and LevelDistance.

C#  Copy Code

tl.NodeDistance = 8;
tl.LevelDistance = 8;

  1. Call the Arrange method to perform the TreeLayout algorithm.

C#  Copy Code

tl.Arrange(DiagramView1.Diagram);

  1. Execute the web application (press CTRL+F5).

After applying the TreeLayout algorithm, the diagram looks as shown below: