Hex2RGB / RGB2Hex, good

« Older   Newer »
  Share  
I.Ren
CAT_IMG Posted on 10/7/2008, 16:38     +1   -1




ecco qui una UDF fatta in 5 minuti.

CODICE
Func Hex2RGB($hex,$ret = '')
  $R = _ColorGetRed($hex)
  $G = _ColorGetGreen($hex)
  $B = _ColorGetBlue($hex)
  Switch $ret
  Case 1
          Return $R
  Case 2
          Return $G
  Case 3
          Return $B
  Case Else
          Return $R&$G&$B
  EndSwitch
EndFunc

Func RGB2Hex($R,$G,$B)
       $1 = Hex($R,2)
       $2 = Hex($G,2)
       $3 = Hex($B,2)
       Return $1&$2&$3
EndFunc


Esempio:

CODICE
$col = InputBox('Inserisci','Inserisci il colore in HEX!')

If StringTrimRight($col,stringlen($col)-2) = '0x' And StringLen($col) = 8 Then
       $1 = Hex2RGB($col,1)
       $2 = Hex2RGB($col,2)
       $3 = Hex2RGB($col,3)
       $RGB = RGB2Hex($1,$2,$3)
       $HEX = Hex2RGB($col)
       MsgBox(0x40,'Risultato','Colore in RGB del hex immesso: '&$HEX&@cr&'Convertito: '&$RGB)
Else
       MsgBox(0x10,'Errore','DEVI mettere un HEX valida!')
EndIf


comments and suggestions are welcome (xD)
 
Top
I.Ren
CAT_IMG Posted on 15/7/2008, 11:21     +1   -1




manco un commentino
 
Top
-Coyote-
CAT_IMG Posted on 22/2/2010, 17:49     +1   -1




è molto utile e molto bello! Da settimane sto cercando un programma del genere e nn ho trovato niente!
 
Top
MHack
CAT_IMG Posted on 23/2/2010, 18:08     +1   -1




Ma non vedete (parlo a tutti quelli che postano nei post morti) che la data è del 2008? Cioè di 2 anni fà... -.-
 
Top
-Anubi-
CAT_IMG Posted on 23/2/2010, 18:09     +1   -1




Non è giusto che non abbia avuto commenti
 
Top
MHack
CAT_IMG Posted on 23/2/2010, 18:12     +1   -1




E' vero! Però mi diventano tutti necroposter XD
 
Top
-Anubi-
CAT_IMG Posted on 23/2/2010, 18:36     +1   -1




Che problema c'è ?
 
Top
MHack
CAT_IMG Posted on 23/2/2010, 21:46     +1   -1




Perchè gli autori di questi post non ci sono più quindi...
 
Top
-Anubi-
CAT_IMG Posted on 24/2/2010, 14:01     +1   -1




Sono morti ? Anubi non ricorda di averli condotti nell'ade...strano...
 
Top
MHack
CAT_IMG Posted on 24/2/2010, 14:22     +1   -1




ahahah XD
 
Top
9 replies since 10/7/2008, 16:38   159 views
  Share