TreeView - change selected Item before Contextmenu opens

L

LinusHechinger

Hello,

I've got a problem,
made a treeview in a nice app, and a contextmenustrip attached to.

When i use rightclick to open the contextmenu,
an a item is selected - it still remains selected,
and not the item under the mouse. to which i want to
use the context-items....

how to switch the selected item before context menu opens ??
 
A

Armin Zingler

LinusHechinger said:
Hello,

I've got a problem,
made a treeview in a nice app, and a contextmenustrip attached to.

When i use rightclick to open the contextmenu,
an a item is selected - it still remains selected,
and not the item under the mouse. to which i want to
use the context-items....

how to switch the selected item before context menu opens ??

Handle the MouseDown event. Select the item under the mouse
if the right button has been pressed. Call the TVW's GetNodeAt
method to determine the node to be selected.
 

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

Top