public Form1() { InitializeComponent(); d = new NodeDiagram(); d.Dock = DockStyle.Fill; pnl.Controls.Add(d); var n = new TextNode(d) { Text = "Test" }; var subn = new ConditionNode(d) { Text = "OK?" }; n.LinksTo = subn; var yesNode = new TextNode(d) { Text = "Alright then", LinksTo = n }; subn.LinksTo.Add(new Condition() { Text = "Yes", LinksTo = yesNode }); subn.LinksTo.Add(new Condition() { Text = "Come again?", LinksTo = subn }); var noNode = new TextNode(d) { Text = "Your loss", LinksTo = subn }; subn.LinksTo.Add(new Condition() { Text = "No", LinksTo = noNode }); d.Nodes.Add(n); d.Nodes.Add(subn); d.Nodes.Add(yesNode); d.Nodes.Add(noNode); d.Nodes.Add(n); var unlinkedNode = new TextNode(d) { Text = "Unlinked " }; d.Nodes.Add(unlinkedNode); foreach (var node in d.Nodes) { node.Direction = Node.DirectionEnum.Vertical; } d.AutoLayout(true); }
private void btnAutoLayout_Click(object sender, EventArgs e) { d.AutoLayout(false); }