Exemplo n.º 1
0
 public virtual void DrawSelectionBackground(Graphics dc, Rectangle nodeRect, Node node)
 {
     if (m_owner.NodesSelection.Contains(node) || m_owner.FocusedNode == node)
     {
         if (!Application.RenderWithVisualStyles)
         {
             // have to fill the solid background only before the node is painted
             dc.FillRectangle(SystemBrushes.FromSystemColor(SystemColors.Highlight), nodeRect);
         }
         else
         {
             // have to draw the transparent background after the node is painted
             VisualStyleItemBackground.Style style = VisualStyleItemBackground.Style.Normal;
             if (m_owner.Focused == false)
                 style = VisualStyleItemBackground.Style.Inactive;
             VisualStyleItemBackground rendere = new VisualStyleItemBackground(style);
             rendere.DrawBackground(m_owner, dc, nodeRect);
         }
     }
     if (m_owner.Focused && (m_owner.FocusedNode == node))
     {
         nodeRect.Height += 1;
         nodeRect.Inflate(-1,-1);
         ControlPaint.DrawFocusRectangle(dc, nodeRect);
     }
 }
Exemplo n.º 2
0
 public virtual void DrawSelectionBackground(Graphics dc, Rectangle nodeRect, Node node)
 {
     if (m_owner.NodesSelection.Contains(node) || m_owner.FocusedNode == node)
     {
         if (!Application.RenderWithVisualStyles)
         {
             // have to fill the solid background only before the node is painted
             dc.FillRectangle(SystemBrushes.FromSystemColor(SystemColors.Highlight), nodeRect);
         }
         else
         {
             // have to draw the transparent background after the node is painted
             VisualStyleItemBackground.Style style = VisualStyleItemBackground.Style.Normal;
             if (m_owner.Focused == false)
             {
                 style = VisualStyleItemBackground.Style.Inactive;
             }
             VisualStyleItemBackground rendere = new VisualStyleItemBackground(style);
             rendere.DrawBackground(m_owner, dc, nodeRect);
         }
     }
     if (m_owner.Focused && (m_owner.FocusedNode == node))
     {
         nodeRect.Height += 1;
         nodeRect.Inflate(-1, -1);
         ControlPaint.DrawFocusRectangle(dc, nodeRect);
     }
 }