In my winform application I have a treeview. To give the idea that a node is disabled I set the node’s forecolor and I when the BeforeSelect fires I set e.cancel to true.
However when a node’s tag meets some criteria a node may be selected. So that’s why I have a NodeMouseClick. But when a node may not be clicked I set the e.cancel to true in the BeforeSelect event.
The problem now is, the NodeMousClick event is always fired and all the code is ececuted, even when I set e.cancel to true in the BeforeSelect event. Why is that?
Because the node won’t be / become selected (you’ve cancelled that out), but still being clicked upon.
When you’ve completed your “check whether node can be selected routine” and not-cancelling it (therefor: enabled the click); check if the node is selected