Beispiel #1
0
        public void DrawNode()
        {
            Brush b = new SolidBrush(NodeColor);
            Pen   p = new Pen(Color.Black, 2);

            DrawSelf(b, p);

            //calc point
            Point begin = new Point(SelfOutRect.Right, SelfOutRect.Top + SelfOutRect.Height / 2);
            Point end   = new Point();

            foreach (var child in Children)
            {
                end.X = child.SelfOutRect.Left;
                end.Y = child.SelfOutRect.Top + child.SelfOutRect.Height / 2;
                ShapeHelper.DrawConnectLine(nodeGraphics, p, begin, end);
                child.DrawNode();
            }
        }
Beispiel #2
0
        public override void OnPaint(PaintEventArgs e)
        {
            Init();

            //绘制原图
            Root.SetGraphics(e.Graphics);
            Root.CalcNodeHeight();
            Root.CalcNodeWidth();
            Root.SelfOutRect.X = ClientSize.Width / 2 - Root.NodeOutRect.Width / 2;
            Root.SelfOutRect.Y = ClientSize.Height / 2;

            Root.AutoLayout();
            Root.DrawNode();
            if (CurrentSelectNode != null)
            {
                CurrentSelectNode.DrawOutLine(outlinePen);
            }

            if (!IsMoving || CurrentMoveNode == null)
            {
                return;
            }
            //绘制移动的节点
            CurrentMoveNode.SelfOutRect.X = MovingPos.X - CurrentMoveNode.SelfOutRect.Width / 2;
            CurrentMoveNode.SelfOutRect.Y = MovingPos.Y - CurrentMoveNode.SelfOutRect.Height / 2;
            CurrentMoveNode.DrawSelf(moveBrush, movePen);

            if (MoveToParentNode == null)
            {
                return;
            }
            //绘制父节点连线
            MoveToParentNode.DrawOutLine(outlinePen);
            CurrentMoveNode.DrawOutLine(outlinePen);
            ShapeHelper.DrawConnectLine(e.Graphics, outlinePen, MoveToParentNode.ConnectOutPos, CurrentMoveNode.ConnectInPos);
        }
Beispiel #3
0
 public override void OnPaint(PaintEventArgs e)
 {
     ShapeHelper.DrawConnectLine(e.Graphics, drawPen, ConnectBegin, ConnectEnd);
 }