최고의 답변자
TreeView Contro; in C#: How to highlight a selected node by Mouse-Right-Click ?

질문
-
답변
-
Hi TFukuda-DocumentFusion,
We just need to execute the following code when we use the mouse right button click on the node:
// Sets the tree node that is currently selected in the tree view control. treeView1.SelectedNode = treeView1.GetNodeAt(e.X, e.Y);
And the complete method is:
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { treeView1.SelectedNode = treeView1.GetNodeAt(e.X, e.Y); } }
If there's any concern, please feel free to follow up.
Have a nice day!
Mike [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 답변으로 표시됨 Mike Dos ZhangModerator 2011년 1월 24일 월요일 오전 5:50
모든 응답
-
Hi TFukuda-DocumentFusion,
We just need to execute the following code when we use the mouse right button click on the node:
// Sets the tree node that is currently selected in the tree view control. treeView1.SelectedNode = treeView1.GetNodeAt(e.X, e.Y);
And the complete method is:
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { treeView1.SelectedNode = treeView1.GetNodeAt(e.X, e.Y); } }
If there's any concern, please feel free to follow up.
Have a nice day!
Mike [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 답변으로 표시됨 Mike Dos ZhangModerator 2011년 1월 24일 월요일 오전 5:50
-
Hi TFukuda-DocumentFusion,
Have you tried the suggestion? Has this question been solved?
If there's any concern, please feel free to let us know.
Have a nice day!
Mike [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
Hi TFukuda-DocumentFusion,
You're welcome!
If there's any concern, please feel free to let me know.
Have a nice day!
Mike [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.