pcpunch
Messages postés1243Date d'inscriptionmardi 7 mai 2002StatutMembreDernière intervention18 février 2019
-
5 avril 2003 à 13:02
avelis
Messages postés22Date d'inscriptionlundi 13 novembre 2000StatutMembreDernière intervention 6 août 2006
-
18 août 2005 à 11:59
Slt je cherche un moyen de transformer une couleur vb en courleur Web (format RRGGBB Hex : Code couelur pour Skin Bsplayer)
G bien une source mais ca fonctionne pas!!!
Qd je selectionne le rouge c du bleue qui en resulte???
Private Sub Command37_Click()
With CommonDialog1
.Flags = cdlCCRRGBInit
.ShowColor
colortxt.BackColor = .Color ' c un controle im qui affiche la couelur VB
txt1.ForeColor = .Color
txt2.ForeColor = .Color
txt3.ForeColor = .Color
txt4.ForeColor = .Color
txt5.ForeColor = .Color
txt6.ForeColor = .Color
'convertion de la couleur en html RRGGBB hex
Dim Strcolor As String
Dim strnum1, strnum2, strnum3 As String
Strcolor = Hex$(colortxt.BackColor)
Do Until Len(Strcolor) = 6
Strcolor = Strcolor & "0"
Loop
avelis
Messages postés22Date d'inscriptionlundi 13 novembre 2000StatutMembreDernière intervention 6 août 2006 18 août 2005 à 11:59
Je répond aussi sur cette page au cas où...
Salut, je suis tombé sur le même problème car j'utilisais Format(Hex(color),"000000") mais ca marche pas dans le cas où le nombre s'écrit avec des caractères hexa (A-F) donc j'ai fait la petite procédure suivante :
Dim strR As String
Dim strG As String
Dim strB As String
Dim strColor As String
strR = Hex(dlgFont.Color And 255)
strG = Hex(dlgFont.Color \ 256 And 255)
strB = Hex(dlgFont.Color \ 65536 And 255) If Len(strR) 1 Then strR "0" & strR If Len(strG) 1 Then strG "0" & strG If Len(strB) 1 Then strB "0" & strB
strColor = strR & strG & strB
J'espère que c'est bien ce que tu voulais :)
J'ai fait pas mal de test ca à l'air de fonctionner !