You can use the method displayed by the control in combination with the location of the mouse cursor when the event ( ) occurred , to determine which node was pressed (and therefore they will be selected at the end of the event). For instance: HitTestTreeViewMouseClick e.Location
private void TreeView_MouseClick(object sender, MouseEventArgs e)
{
TreeNode selectedNode = myTreeView.HitTest(e.Location).Node;
if (selectedNode != null)
{
}
}
, , selectedNode null, - . , node, selectedNode, HitTest, null.
, , selectedNode TreeView. node , MouseClick - . node, .
:
. :
TVRecorder.Nodes[0].Nodes.Add(Convert.ToString(testplan_key), testplan_desc, "P", "Test_Plan");
node, TreeView. , node. , node (. ), , node, :
selectedNode.Nodes.Add(Convert.ToString(testplan_key), testplan_desc, "P", "Test_Plan");
, node ( TreeNode ) Nodes , TreeNodeCollection. node. MSDN, , , :
Nodes TreeNode. node [s] Nodes, TreeNodeCollection. . FullPath .