I.Ren |
|
| 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)
|
| |