I have two TreeView controls on a form. What I need to do is indicate to the user when they are allowed to drag specific items from TreeView A to TreeView B by displaying different cursors.
How can I accomplish this ?
I have two TreeView controls on a form. What I need to do is indicate to the user when they are allowed to drag specific items from TreeView A to TreeView B by displaying different cursors.
How can I accomplish this ?
You can try handling the
MouseMove
event, perform some hit testing to know which node is moved over, then change the cursor. The following code should do what you want, I suppose the nodes that can be dragged will have a Hand cursor, otherwise the Arrow cursor is shown.You have to add your nodes which need to be indicated as draggable to the hashset
sepcialNodes
, it's up to you. Using a hashset will help improve the performance in case you have a lot of nodes.In case you don't know how to register the handler above with the event
MouseMove
, try adding this code to your Form constructor (afterInitializeComponent
):