Hit-Parade .VB Research Center . Compteur
Accueil ~  Code ~  Programmes ~  Api ~  Forum ~  Cours ~  Livres ~  Quiz ~  Annuaire
~ Edito ~
12/03/2006 @ 13:39
Depuis la dernière mise à jour (qui remonte à... oulala plusieurs mois), un petit ménage de printemps s'impose. Ca tombe bien, c'est presque la période.
Au menu, et progressivement sur les jours à venir, rafraîchissement de plusieurs fonctions et procédures, nouvelles APIs et nouveaux programmes.

~ Rechercher ~

  

~ Annuaire VB ~
 Rechercher un site :
  

~ Partenaires ~

Procédure : SetTVColour
Modifie la couleur de fond, ou du texte d'un TreeView.
Origine : Nicolas
(Consulté 19505 fois.)

Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
        (
ByVal hwnd As Long, ByVal wMsg As Long, _
       
ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function
GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
Public Declare Function
GetWindowLong Lib "user32" Alias "GetWindowLongA" _
        (
ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function
SetWindowLong Lib "user32" Alias "SetWindowLongA" _
        (
ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Const
GWL_STYLE As Long = -16&
Public Const COLOR_WINDOW = 5
Public Const COLOR_WINDOWTEXT = 8
Public Const TVS_HASLINES As Long = 2
Public Const TV_FIRST As Long = &H1100
Public Const TVM_SETBKCOLOR As Long = (TV_FIRST + 29)
Public Const TVM_SETTEXTCOLOR As Long = (TV_FIRST + 30)
Public Const TVM_GETBKCOLOR As Long = (TV_FIRST + 31)
Public Const TVM_GETTEXTCOLOR As Long = (TV_FIRST + 32)

Public Sub SetTVColour(hwndTV As Long, lgClrref As Long, Optional blBackColour As Boolean = True)
' Modifie la couleur de fond, ou du texte, du treeview dont le Handle est passé en paramêtre.
Dim lgStyle As Long
If
blBackColour Then
    ' Change la couleur de fond
    Call SendMessageLong(hwndTV, TVM_SETBKCOLOR, 0, lgClrref)
Else
    ' Change la couleur du texte
    Call SendMessageLong(hwndTV, TVM_SETTEXTCOLOR, 0, lgClrref)
End If
lgStyle = GetWindowLong(hwndTV, GWL_STYLE)
If lgStyle And TVS_HASLINES Then
    Call SetWindowLong(hwndTV, GWL_STYLE, lgStyle Xor TVS_HASLINES)
   
Call SetWindowLong(hwndTV, GWL_STYLE, lgStyle)
End If
End Sub
Visual Basic Research Center - (c) 2000/2002 -  Webmaster : docvb (chez) free (point) fr