示例#1
0
 internal HitTestResult HitTest(SmartTreeNode node, Point location)
 {
     if (node.Bounds.Contains(location))
     {
         if (node.GetHighlightArea().Contains(location))
         {
             return(HitTestResult.NodeContent);
         }
         if (node.Nodes.Count > 0)
         {
             int       iconHeight        = Properties.Resources.Plus.Height;
             int       imageLocationY    = node.Bounds.Top + ((int)(_ownerTree.Font.SizeInPoints * 2) - iconHeight) / 2;
             Rectangle expanderRectangle = new Rectangle(node.Bounds.Left, imageLocationY,
                                                         Properties.Resources.Plus.Width,
                                                         Properties.Resources.Plus.Height);
             if (expanderRectangle.Contains(location))
             {
                 return(HitTestResult.Expander);
             }
         }
         if (node.HasCheckBox)
         {
             int       iconWidth         = Properties.Resources.Plus.Width;
             int       checkBoxLocationY = node.Bounds.Top + ((int)(_ownerTree.Font.SizeInPoints * 2) - SmartTree.CheckBoxHeight) / 2;
             int       checkBoxLocationX = node.Bounds.Left + iconWidth + _ownerTree.HorizontalSpace;
             Rectangle checkBoxRectangle = new Rectangle(checkBoxLocationX, checkBoxLocationY,
                                                         SmartTree.CheckBoxWidth, SmartTree.CheckBoxHeight);
             if (checkBoxRectangle.Contains(location))
             {
                 return(HitTestResult.CheckBox);
             }
         }
     }
     return(HitTestResult.None);
 }
示例#2
0
 internal HitTestResult HitTest(SmartTreeNode node, Point location) {
    if( node.Bounds.Contains(location) ) {
       if( node.GetHighlightArea().Contains(location) ) {
          return HitTestResult.NodeContent;
       }
       if( node.Nodes.Count > 0 ) {
          int iconHeight = Properties.Resources.Plus.Height;
          int imageLocationY = node.Bounds.Top + ( (int) ( _ownerTree.Font.SizeInPoints * 2 ) - iconHeight ) / 2;
          Rectangle expanderRectangle = new Rectangle(node.Bounds.Left, imageLocationY,
                                                      Properties.Resources.Plus.Width,
                                                      Properties.Resources.Plus.Height);
          if( expanderRectangle.Contains(location) ) {
             return HitTestResult.Expander;
          }
       }
       if( node.HasCheckBox ) {
          int iconWidth = Properties.Resources.Plus.Width;
          int checkBoxLocationY = node.Bounds.Top + ( (int) ( _ownerTree.Font.SizeInPoints * 2 ) - SmartTree.CheckBoxHeight ) / 2;
          int checkBoxLocationX = node.Bounds.Left + iconWidth + _ownerTree.HorizontalSpace;
          Rectangle checkBoxRectangle = new Rectangle(checkBoxLocationX, checkBoxLocationY,
             SmartTree.CheckBoxWidth, SmartTree.CheckBoxHeight);
          if( checkBoxRectangle.Contains(location) ) {
             return HitTestResult.CheckBox;
          }
       }
    }
    return HitTestResult.None;
 }
示例#3
0
 internal void RepaintNode(SmartTreeNode node) {
    _contentPanel.Invalidate(node.GetHighlightArea());
 }
示例#4
0
 internal void RepaintNode(SmartTreeNode node)
 {
     _contentPanel.Invalidate(node.GetHighlightArea());
 }