Ejemplo n.º 1
0
        public void DrawRelationship(IRenderer Renderer)
        {
            NodeRelationship rel = TreeView.Relationship;

            if (rel == null)
            {
                return;
            }
            Control sender = ExtractCoreControl(rel.Sender);

            List <Control> receivers = new List <Control>();

            foreach (Block receiver in rel.Receivers)
            {
                receivers.Add(ExtractCoreControl(receiver));
            }

            List <int> Ys = new List <int>();
            List <int> Xs = new List <int>();

            Ys.Add(sender.Bounds.CenterY);
            Xs.Add(sender.Bounds.Right);
            foreach (Control c in receivers)
            {
                Ys.Add(c.Bounds.CenterY);
                Xs.Add(c.Bounds.Right);
            }

            int yMin = 0;
            int yMax = 0;

            FindMinMaxY(Ys, out yMin, out yMax);
            int x = FindMaxWidth() + ArrowRightMargin;

            ILineStyleInfo style;

            if (rel.Direction)
            {
                style = DefaultLineStyle;
            }
            else
            {
                style = DefaultReverseLineStyle;
            }

            IDrawOperations op = Renderer.DrawOperations;

            op.DrawLine(x, yMin, x, yMax, style);
            op.DrawLine(Xs[0] + 2, Ys[0], x, Ys[0], style);

            for (int i = 1; i < Xs.Count; i++)
            {
                op.DrawLine(Xs[i] + 3, Ys[i], x, Ys[i], style);

                if (rel.Direction)
                {
                    DrawArrow(Renderer, Xs[i] + 2, Ys[i]);
                }
                else
                {
                    op.DrawLine(Xs[i] + 3, Ys[i] - 4, Xs[i] + 3, Ys[i] + 4, style);
                }
            }
            if (rel.Direction)
            {
                op.DrawLine(Xs[0] + 1, Ys[0] - 4, Xs[0] + 1, Ys[0] + 4, style);
            }
            else
            {
                DrawArrow(Renderer, Xs[0] + 2, Ys[0]);
            }
        }
Ejemplo n.º 2
0
 protected virtual void InitDrawOperations()
 {
     mDrawOperations = new GDIDrawOperations(hDC);
 }