private TreeNode _GetNodeAtPosition(TreeNode rootNode, Point position)
{
if (rootNode != root && rootNode.IsVisible)
{
int nodeWidth = Width;
var rootNodeRect = new Rectangle(rootNode.Bounds.X, rootNode.Bounds.Y - (int)scrollIndex, nodeWidth, rootNode.Bounds.Height);
if (UseNodeBoundsForSelection == false) rootNodeRect.X = 0;
if (rootNodeRect.Contains(position))
return rootNode;
}
if (rootNode.IsExpanded)
for (int i = 0; i < rootNode.Nodes.Count; i++)
{
var result = _GetNodeAtPosition(rootNode.Nodes[i], position);
if (result != null) return result;
}
return null;
}
private Rectangle _GetNodeBounds(TreeNode node)