Hi Jack
I think this is the sort of thing you need. Before expanding or collapsing,
it checks whether you've just double clicked on the control. You'll need to
put your open a form logic into the OnDoubleClick override method as well.
Code follows...
HTH
Nigel Armstrong
Class MyTree
Inherits TreeView
Dim doneByDoubleClick As Boolean = False
Protected Overrides Sub OnDoubleClick(ByVal e As System.EventArgs)
doneByDoubleClick = True
End Sub
Protected Overrides Sub OnBeforeExpand(ByVal e As TreeViewCancelEventArgs)
If doneByDoubleClick Then e.Cancel = True
doneByDoubleClick = False
End Sub
Protected Overrides Sub OnBeforeCollapse(ByVal e As
TreeViewCancelEventArgs)
If doneByDoubleClick Then e.Cancel = True
doneByDoubleClick = False
End Sub
End Class
"Jack" wrote:
Thanks for the response and it's a good question. I want double-clicking on a
node to open a data entry form regarding that node. So, i'd like to limit
collapsing and expanding nodes to just the plus and minus signs.
"C-Services Holland b.v." wrote:
Jack wrote: Hello,
I would like some advice on how to disable the behavior of treeviews to
expand and collapse when double clicked upon, but still allow the user to use
the plus and minus on each node.
I can't see the logic in that. Why prevent doubleclicking when
collapsing the tree is allowed?
--
Rinze van Huizen
C-Services Holland b.v.