示例#1
0
        internal override void OnPaint(PaintEventArgs e)
        {
            if (m_parentNode == null || m_childNode == null)
            {
                return;
            }
            Graphics gc          = e.Graphics;
            Point    parentPoint = m_treeViewer.GetRectangle(m_parentNode).GetChildPoint();
            Point    childPoint  = m_treeViewer.GetRectangle(m_childNode).GetParentPoint();

            if (m_treeViewer.IsObservingRuntimePack())
            {
                BTTreeRuntimePack.RuntimeState parentState = m_treeViewer.GetRuntimeState(m_parentNode);
                BTTreeRuntimePack.RuntimeState childState  = m_treeViewer.GetRuntimeState(m_childNode);
                if (parentState != BTTreeRuntimePack.RuntimeState.Norun &&
                    childState != BTTreeRuntimePack.RuntimeState.Norun)
                {
                    Pen pen = TrueDrawPen;
                    if (parentState == BTTreeRuntimePack.RuntimeState.False &&
                        childState == BTTreeRuntimePack.RuntimeState.False)
                    {
                        pen = FalseDrawPen;
                    }
                    gc.DrawLine(pen, m_treeViewer.GetDrawPosition(parentPoint),
                                m_treeViewer.GetDrawPosition(childPoint));
                }
            }
            gc.DrawLine(Pens.Black, m_treeViewer.GetDrawPosition(parentPoint),
                        m_treeViewer.GetDrawPosition(childPoint));
        }
示例#2
0
 /**
  * @brief draw the debug trail of the rectangle
  **/
 protected void DrawDebugTrail(Graphics _gc, Rectangle _rect)
 {
     if (m_treeViewer.IsObservingRuntimePack())
     {
         BTTreeRuntimePack.RuntimeState state = m_treeViewer.GetRuntimeState(m_node);
         Point location = new Point(_rect.Location.X - runStateBorderWidth,
                                    _rect.Location.Y - runStateBorderWidth);
         Size size = new Size(_rect.Size.Width + 2 * runStateBorderWidth,
                              _rect.Size.Height + 2 * runStateBorderWidth);
         Rectangle rect = new Rectangle(location, size);
         if (state == BTTreeRuntimePack.RuntimeState.True)
         {
             _gc.FillRectangle(TrueFillBrush, rect);
         }
         else if (state == BTTreeRuntimePack.RuntimeState.False)
         {
             _gc.FillRectangle(FalseFillBrush, rect);
         }
     }
 }