1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long
Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
Private Enum eSystemColor
eClrScrollbar = 0
eClrBackground = 1
eClrActivecaption = 2
eClrInactivecaption = 3
eClrMenu = 4
eClrWindow = 5
eClrWindowframe = 6
eClrMenutext = 7
eClrWindowtext = 8
eClrCaptiontext = 9
eClrActiveborder = 10
eClrInactiveborder = 11
eClrAppworkspace = 12
eClrHighlight = 13
eClrHighlighttext = 14
eClrBtnface = 15
eClrBtnshadow = 16
eClrGraytext = 17
eClrBtntext = 18
eClrInactivecaptiontext = 19
eClrBtnhighlight = 20
End Enum
Private Sub CommandButton1_Click()
Dim NewColor As Long
Dim OldColor As Long
OldColor = GetSysColor(eSystemColor.eClrCaptiontext)
If MsgBox("Changer le couleur du titre en rouge ?", 36, "Changer") = 6 Then
NewColor = SetSysColors(1, eSystemColor.eClrCaptiontext, RGB(255, 0, 0))
End If
End Sub |
Partager