Public Type RGB_Color Red As Integer Green As Integer Blue As Integer End Type Public Function HexaToRGB(HexaValue As String) As RGB_Color Dim Temp As RGB_Color If Len(HexaValue) <> 6 Then Exit Function Temp.Red = HexaToDecimal(Left$(HexaValue, 2)) Temp.Green = HexaToDecimal(Mid$(HexaValue, 3, 2)) Temp.Blue = HexaToDecimal(Right$(HexaValue, 2)) HexaToRGB = Temp End Function Private Function HexaToDecimal(HexaValue As String) As Integer Dim TempVal As String For i = 0 To 255 If i < 16 Then TempVal = "0" & CStr(Hex(i)) Else TempVal = CStr(Hex(i)) End If If UCase(HexaValue) = TempVal Then HexaToDecimal = i Exit Function End If Next End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question