private void DrawTreeNodeRecursive(Graphics g, LayoutTreeNode node) { g.DrawRectangle(Pens.Black, Rectangle.Round(node.Extent)); node.Draw(g); foreach (LayoutTreeNode childNode in node.Children) { DrawTreeNodeRecursive(g, childNode); } }
public T CreateNode <T> (LayoutTreeNode parent) where T : LayoutTreeNode, new() { T retNode = new T(); retNode.Owner = this; retNode.LayerInfo = this.lyrInfo; if (parent == null) { this.root = retNode; retNode.Level = 0; } else { parent.Children.Add(retNode); retNode.Level = parent.Level + 1; } return(retNode); }
private void Form1_Load(object sender, EventArgs e) { LayoutTree lTree = new LayoutTree(); lTree.VerticalSpacer = 20.0f; lTree.HorizontalSpacer = 30.0f; TextLayoutTreeNode root = lTree.CreateNode <TextLayoutTreeNode>(null); root.Text = "root"; TextLayoutTreeNode c0 = lTree.CreateNode <TextLayoutTreeNode>(root); c0.Text = "c0"; TextLayoutTreeNode c1 = lTree.CreateNode <TextLayoutTreeNode>(root); c1.Text = "aaaaaaaaaaaaa\naaaaaaaaaaaaa"; TextLayoutTreeNode c2 = lTree.CreateNode <TextLayoutTreeNode>(c1); c2.Text = "c2"; TextLayoutTreeNode c3 = lTree.CreateNode <TextLayoutTreeNode>(c1); c3.Text = "bbbbbbbbbbbb"; rootNode = root; }