Home > Software engineering >  [for] vb treeview double-click don't trigger events
[for] vb treeview double-click don't trigger events

Time:09-17

Vb treeview this control, and then double-click a node, he will automatically expand/contract the following child nodes, I don't want to let him expansion/contraction, now how do I write this code?

CodePudding user response:

Is that what your treeview? If it's just to see, cover it with a picture, did not respond to any event,

CodePudding user response:

Don't know the hooks its message processing can do,

CodePudding user response:

Treeview expand and Collapse events to handle
For example

 
Private Sub Command1_Click ()
T1. Nodes. The Add, "n1" and "node1
"T1. Nodes. The Add "n1", tvwChild, "n1-1", "node1-1
"T1. Nodes. The Add, "n2", "2",
T1. Nodes. The Add "n2", tvwChild, "n2-1", "2-1
"End Sub

Private Sub t1_Collapse (ByVal Node As MSComctlLib. Node)
If the Node. The Key="n2" Then
Node. Expanded=Not (Node. Expanded)
End the If
End Sub

Private Sub t1_Expand (ByVal Node As MSComctlLib. Node)
If the Node. The Key="n1" Then
Node. Expanded=Not (Node. Expanded)
End the If
End Sub


Node1 and 2 children
Node1 does not allow, 2 are not allowed to shrink

  • Related