Como guardo uma cor (TColor) no formato string
20/08/2004
0
Como a varíavel cor do componente é do tipo TColor, não consigo jogá-la para o formato string para que o arquivo .ini aceite.
Como eu poderia fazer isso? Ou seja, eu precisaria transformar clBlue ou qualquer outra cor para uma palavra(string). Ou há outra maneira.
Obrigado.
Valdirdill
Post mais votado
21/08/2004
Emerson Nascimento
Mais Posts
20/08/2004
Tatuweb
function TColorToHex (Color: TColor) : string; begin Result := IntToHex (GetRValue (Color), 2) + IntToHex (GetGValue (Color), 2) + IntToHex (GetBValue (Color), 2); end; function HexToTColor (sColor: string) : TColor; begin Result := RGB (StrToInt (´$´+Copy (sColor, 1, 2)), StrToInt (´$´+Copy (sColor, 3, 2)), StrToInt (´$´+Copy (sColor, 5, 2))); end;
20/08/2004
Valdirdill
function TColorToHex (Color: TColor) : string; begin Result := IntToHex (GetRValue (Color), 2) + IntToHex (GetGValue (Color), 2) + IntToHex (GetBValue (Color), 2); end; function HexToTColor (sColor: string) : TColor; begin Result := RGB (StrToInt (´$´+Copy (sColor, 1, 2)), StrToInt (´$´+Copy (sColor, 3, 2)), StrToInt (´$´+Copy (sColor, 5, 2))); end;
10/12/2020
Rogerio Bras
Emerson Nascimento, testei aqui no Delphi Rio 10.3 e funcionou perfeitamente. Muito obrigado!
Clique aqui para fazer login e interagir na Comunidade :)