public void TreeNodeTest() { var tree = new ColumnTree { Roots = new List <ColumnTreeNode> { TestNode } }; var retangles = tree.CalculateRetangles(); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(retangles)); Assert.AreEqual(11, retangles.Count); }
public void Draw(ColumnTree tree, System.Drawing.Graphics formGraphics) { // var retangles = node.CalculateRetangles(0, node.MaxDepth); var retangles = tree.CalculateRetangles(); foreach (var c in retangles) { label1.Text += c.ToString() + Environment.NewLine; System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush (Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256))); formGraphics.FillRectangle(myBrush, new Rectangle( c.RetanglePosition.X * 20, c.RetanglePosition.Y * 20, c.RetangleSize.Width * 20, c.RetangleSize.Height * 20)); myBrush.Dispose(); } }