Dynamic Context Menu on Treeview Nodes

dr. evil picture dr. evil · Dec 13, 2008 · Viewed 10.9k times · Source

Duplicate Of : Find node clicked under context menu

I've got a context menu on a Treeview, when the user right clicks it supposed to change based on the currently right clicked node's tag object.

Currently I'm updating the context menu in after_select event, however this doesn't work when user right clicks to another node without selecting it.

How can I detect which node right clicked and change the context menu? Or am I doing it wrong?

Answer

Guge picture Guge · Dec 14, 2008

You can use the MouseDown event and the HitTest method to find out which node was clicked.