예제 #1
0
        public void Display(PictureBox pb)
        {
            CFGraph        graphR  = new CFGraph(pb, 1, 10, 19);
            TreeParameters tParams = new TreeParameters(graphR);

            NodeToDisplay(_root, tParams, 0, pb.Width, 0);
            tParams.graphRenderer.EndOfDraw();
        }
예제 #2
0
        private void NodeToDisplay(Node node, TreeParameters p, int left, int right, int lvl)
        {
            if (node == null)
            {
                return;
            }

            var x = (left + right) / 2;
            var y = (++lvl * TreeParameters.OFFSET);

            p.graphRenderer.AddNode(node.Value.ToString(),
                                    new PointF(x, y));

            if (p.nodeName != null)
            {
                p.graphRenderer.AddConnectionLine(p.nodeName, node.Value.ToString());
            }

            p.nodeName = node.Value.ToString();
            NodeToDisplay(node.Left, p, left, x, lvl);
            p.nodeName = node.Value.ToString();
            NodeToDisplay(node.Right, p, x, right, lvl);
        }