Menu

Sreizine Messages postés 21 Date d'inscription vendredi 14 juin 2002 Statut Membre Dernière intervention 10 mai 2004 - 8 déc. 2002 à 17:02
Sreizine Messages postés 21 Date d'inscription vendredi 14 juin 2002 Statut Membre Dernière intervention 10 mai 2004 - 9 déc. 2002 à 18:13
Je chercherai un moyen de changer la couleur du texte des menus. Avec les apis j'ai trouvé un moyen de changer la couleur du fond mais pas celle du texte.
Quelqu'un aurait-il une idée?

2 réponses

cs_moustachu Messages postés 1079 Date d'inscription jeudi 14 novembre 2002 Statut Membre Dernière intervention 1 janvier 2012
9 déc. 2002 à 10:08
C'est le forum à l'envers... je cherchais justement comment changer la couleur de fond d'un menu, comment t'as fait ?
0
Sreizine Messages postés 21 Date d'inscription vendredi 14 juin 2002 Statut Membre Dernière intervention 10 mai 2004
9 déc. 2002 à 18:13
Tu inséres les lignes suivantes et remplace vbred par la couleur que tu veux. Sinon alors personne ne sait comment changer la couleur du texte?

Private Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush As LOGBRUSH) As Long
Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetMenuInfo Lib "user32" (ByVal hMenu As Long, lpcmi As tagMENUINFO) As Long
Private Declare Function SetMenuInfo Lib "user32" (ByVal hMenu As Long, lpcmi As tagMENUINFO) As Long
Private Type LOGBRUSH
lbStyle As Long
lbColor As Long
lbHatch As Long
End Type
Private Type tagMENUINFO
cbSize As Long
fMask As Long
dwStyle As Long
cyMax As Long
hbrBack As Long
dwContextHelpID As Long
dwMenuData As Long
End Type

Private Const BS_SOLID = 0
Private Const MIM_APPLYTOSUBMENUS = &H80000000
Private Const MIM_BACKGROUND = &H2

Private Sub Form_Load()
Dim ret As Long
Dim hMenu As Long
Dim hBrush As Long
Dim lbBrushInfo As LOGBRUSH
Dim miMenuInfo As tagMENUINFO

lbBrushInfo.lbStyle = BS_SOLID
lbBrushInfo.lbColor = vbRed
lbBrushInfo.lbHatch = 0
hBrush = CreateBrushIndirect(lbBrushInfo)
hMenu = GetMenu(Me.hWnd)
miMenuInfo.cbSize = Len(miMenuInfo)
ret = GetMenuInfo(hMenu, miMenuInfo)
miMenuInfo.fMask = MIM_APPLYTOSUBMENUS Or MIM_BACKGROUND
miMenuInfo.hbrBack = hBrush
ret = SetMenuInfo(hMenu, miMenuInfo)

End Sub
0
Rejoignez-nous