No contraer Treeview

Tengo un control Treeview que inicialmente lo muestro expandido
Cada uno tiene lo sgte
- Categoria 1
Tema 1
Tema 2
Tema 3
- Categoria 2
Tema 1
Tema 2
Tema 3
.. Etc,
lo que deseo es que no se puea contraer cada categoria, sino que siempre este expandido, con que propiedad puedo hacer eso

1 respuesta

Respuesta
1
Checa lo siguiente:
Collapse Event (TreeView Control)
Generated when any Node object in a TreeView control is collapsed.
Syntax
Private Sub object_Collapse(ByVal node As Node)
The Collapse event syntax has these parts:
Part Description
object Anobject expression that evaluates to an object in the Applies To list.
node A reference to the clicked Node object.
Remarks
The Collapse event occurs before the standard Click event.
There are three methods of collapsing a Node: by setting the Node object's Expanded property to False, by double-clicking a Node object, and by clicking a plus/minus image when the TreeView control's Style property is set to a style that includes plus/minus images. All of these methods generate the Collapse event.
The event passes a reference to the collapsed Node object. The reference can validate an action, as in the following example:
Private Sub TreeView1_Collapse(ByVal Node As Node)
If Node.Index = 1 Then
Node.Expanded = True ' Expand the node again.
End If
End Sub
Collapse Event (TreeView Control) Example
This example adds one Node object, with several child nodes, to a TreeView control. When the user collapses a Node, the code checks to see how many children the Node has. If it has more than one child, the Node is re-expanded. To try the example, place a TreeView control on a form and paste the code into the form's Declarations section. Run the example, and double-click a Node to collapse it and generate the event.
Private Sub Form_Load()
TreeView1.Style = tvwTreelinesPlusMinusText ' Style 6.
Dim nodX As Node
Set nodX = TreeView1.Nodes.Add(,,"DV","Da Vinci")
Set nodX = TreeView1.Nodes.Add("DV",tvwChild,"T","Titian")
Set nodX = TreeView1.Nodes.Add("T",tvwChild,"R","Rembrandt")
Set nodX = TreeView1.Nodes.Add("R",tvwChild,,"Goya")
Set nodX = TreeView1.Nodes.Add("R",tvwChild,,"David")
nodX.EnsureVisible ' Show all nodes.
End Sub
Private Sub TreeView1_Collapse(ByVal Node As Node)
' If the Node has more than one child node,
' keep the node expanded.
Select Case Node.Children
Case Is > 1
Node.Expanded = True
End Select
End Sub
Tal vez te sirva la propiedad de expanded y el evento de click

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas