Dabblernl
Dabblernl

Reputation: 16121

VB6 TreeView not showing grayed when Enabled=False

We recently had to change the VB5 TreeView of our application to the VB6 one to maintain Windows 8 compatibility. However, the VB6 TreeView does not change its appearance when its Enabled property is set to False. Is this a known problem? Can it be solved?

Upvotes: 1

Views: 499

Answers (1)

jac
jac

Reputation: 9726

I never noticed this before. You can code a work around though it will hurt if you have a lot of nodes.

If (TreeView1.Enabled) Then
    SetTreeViewColor vbWindowText
Else
    SetTreeViewColor vbGrayText
End If

Private Sub SetTreeViewColor(ByVal vColor As SystemColorConstants)
    Dim objNode As Node

    For Each objNode In TreeView1.Nodes
        objNode.ForeColor = vColor
    Next objNode

End Sub

Upvotes: 4

Related Questions