Exemple #1
0
        private Point RenderSubtree(PBTTaskTreeControl <DataType> ttc, int x, int y, float scale)
        {
            // add offset
            if (ttc.Parent is GLGroupLayout)
            {
                x += ttc.Parent.X; y += ttc.Parent.Y;
            }
            x += ttc.X; y += ttc.Y;

            // draw box
            var       tc     = ttc.TaskControl;
            Rectangle border = new Rectangle(
                (int)((x + tc.X) * scale),
                (int)((y + tc.Y) * scale),
                (int)(tc.Width * scale),
                (int)(tc.Height * scale));
            Rectangle content      = new Rectangle(border.X + 1, border.Y + 1, border.Width - 2, border.Height - 2);
            var       borderColor  = tc.Skin.BorderColor;
            var       contentColor = tc.Skin.BackgroundColor;

            GLDraw.FillRect(ref border, ref borderColor);
            GLDraw.FillRect(ref content, ref contentColor);
            //GLDraw.Text((GLFontText)typeof(GLLabel).GetField("textProcessed", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(tc.title), ref content, ref textColor);
            Point bottom = new Point(border.X, border.Y + border.Height);
            float dx     = border.Width / (float)(ttc.Subtrees.Count + 1);

            // draw subtrees
            for (int i = 0; i < ttc.Subtrees.Count; i++)
            {
                bottom.X = border.X + (int)(dx + i * dx);
                lines.Add(new Tuple <Point, Point>(bottom, RenderSubtree(ttc.Subtrees[i], x, y, scale)));
            }
            return(new Point((int)(border.X + border.Width / 2.0), border.Y));
        }