Creating an organizational chart using AddFlow for .NET

For a copy of the sample project please
click here
to download and install the product evaluation.
Introduction
The following code shows how to create an organization chart programmatically using the AddFlow for .NET API.
Detail
// Set some default properties for nodes
AddFlow1.DefNodeProp.Gradient =
true;
AddFlow1.DefNodeProp.TextColor =
Color.Blue;
AddFlow1.DefNodeProp.FillColor =
Color.White;
AddFlow1.DefNodeProp.GradientColor=
Color.Silver;
AddFlow1.DefNodeProp.Shape.Style =
ShapeStyle.Rectangle;
AddFlow1.DefNodeProp.Shadow.Style =
ShadowStyle.RightBottom;
AddFlow1.DefNodeProp.Shadow.Color =
Color.Silver;
AddFlow1.DefNodeProp.Shadow.Size =
new Size(4, 4);
// Set some default properties for link
AddFlow1.DefLinkProp.DrawColor =
Color.Red;
// Create some nodes...
// The shape of the first "root" node is an ellipse instead of
// the default rectangular one.
Node node0 = new Node(0, 0, 80, 48, "World Company", AddFlow1.DefNodeProp);
node0.Shape.Style =
ShapeStyle.Ellipse;
AddFlow1.Nodes.Add(node0);
// Other nodes are rectangular (default shape in this case)
Node node1 = new Node(0, 0, 80, 48, "Sales", AddFlow1.DefNodeProp);
AddFlow1.Nodes.Add(node1);
Node node2 = new Node(0, 0, 80, 48, "Development", AddFlow1.DefNodeProp);
AddFlow1.Nodes.Add(node2);
Node node3 = new Node(0, 0, 80, 48, "Jack", AddFlow1.DefNodeProp);
node3.FillColor =
Color.Yellow;
AddFlow1.Nodes.Add(node3);
Node node4 = new Node(0, 0, 80, 48, "Paul", AddFlow1.DefNodeProp);
node4.FillColor =
Color.Yellow;
AddFlow1.Nodes.Add(node4);
// Create 4 links
node0.OutLinks.Add(node1);
node0.OutLinks.Add(node2);
node2.OutLinks.Add(node3);
node2.OutLinks.Add(node4);
// Display the diagram using a tree layout algorithm
TFlow tflow = new TFlow();
tflow.LayerDistance = 80;
// Distance between layers
tflow.VertexDistance = 80;
// Distance between adjancant nodes
tflow.Layout(AddFlow1);
Visit
Lassalle Technologies
for more information and more samples.