So I have a TreeView in a C# windows form app. What I need is for some nodes to be "locked" so that they cannot be checked (or unchecked), based on a parameter.
What I am doing now is this:
private void tv_local_BeforeCheck(object sender, TreeViewCancelEventArgs e) {
TNode node = (TNode)e.Node;
//if a part node, cancel the action.
if (node.Type == "Part") {
e.Cancel = true;
}
//if a locked node, cancel the action
if (node.Locked == true) {
e.Cancel = true;
}
}
This code works great on a single click of the checkbox, but if the user double clicks on a checkbox, it still checks/unchecks.
I have tried playing with the nodeMouseDoubleClick event, but that doesnt really help, since I cannot cancel the event...
Is there any ideas out there how to cancel a double click event on a node?... or anything else?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…