TreeView - clicking node more than once

  • Thread starter Thread starter Glenn Lerner
  • Start date Start date
G

Glenn Lerner

I have a TreeView control and I'm handling AfterSelect event. This event
is fired after a selection is made. This works well for me.

If I click on the same node twice, AfterSelect is not fired again. How
can I tell when this occurs? (I need to know every time a node is clicked)

I can try Click event but I don't know which node the click was made on.
Is there a way to tell?

Please advise.

Thanks,
Glenn
 
Have you tried event Click and find out which node is being clicked by
looking at property SelectedNode?

Angie
 
If you use the MouseDown event you can write something like:

private void treeView1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
//...
TreeNode selectedNode = treeView1.GetNodeAt(e.X, e.Y);
//...
}
 
Bryan said:
If you use the MouseDown event you can write something like:

private void treeView1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
//...
TreeNode selectedNode = treeView1.GetNodeAt(e.X, e.Y);
//...
}

That worked great. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top