Put this somewhere in the General Declarations area:
You may get other non-defined things but come on, really...Code:Private Const GWL_STYLE = (-16)
This is a TreeView! And it requires going to the Components window (OH THE HORROR)!
So nobody really feels like actually trying out this code in VB.
As for the no-popup-window and setting the color directly in the code, replace these subs:
With these:Code:Private Sub cmdBackColor_Click() Dim lngColor As Long On Error Resume Next With CommonDialog1 .CancelError = True .ShowColor If Err.Number = cdlCancel Then Exit Sub lngColor = .Color End With SetTreeColor TreeView1, BACK_COLOR, lngColor End Sub Private Sub cmdForeColor_Click() Dim lngColor As Long Dim lngStyle As Long On Error Resume Next With CommonDialog1 .CancelError = True .ShowColor If Err.Number = cdlCancel Then Exit Sub lngColor = .Color End With SetTreeColor TreeView1, FORE_COLOR, lngColor End Sub
Code:Private Sub cmdBackColor_Click() Dim lngColor As Long lngColor = RGB(50, 100, 200) ' BackColor SetTreeColor TreeView1, BACK_COLOR, lngColor End Sub Private Sub cmdForeColor_Click() Dim lngColor As Long lngColor = RGB(200, 100, 50) ' ForeColor SetTreeColor TreeView1, FORE_COLOR, lngColor End Sub





Reply With Quote