Private Sub ChangeBackgroundColor(ByVal hWnd As Long, ByVal _
longColor As Long)
Dim longStyle As Long
SendMessage hWnd, TVM_SETBKCOLOR, 0, ByVal _
TranslateColor(longColor)
' Reset style so lines display properly (for TreeView
' control only)
longStyle = GetWindowLong(hWnd, GWL_STYLE)
SetWindowLong hWnd, GWL_STYLE, _
longStyle And (Not TVS_HASLINES)
SetWindowLong hWnd, GWL_STYLE, longStyle
End Sub
|