TColor para html

Delphi

05/05/2004

Tem alguma forma automática de converter cor de TColor para o padrão HTML ?

Grato


Motta

Motta

Curtidas 0

Respostas

Cebikyn

Cebikyn

05/05/2004

Vc pode usar esta função:

function ColorToHtml1(Color: TColor): string;
var
  COL: LongInt;
begin
  COL := ColorToRGB(Color);
  Result := ´#´ + IntToHex(COL and $FF, 2) +
    IntToHex(COL shr 8 and $FF, 2) +
    IntToHex(COL shr 16 and $FF, 2);
end; 


ou esta:

function ColorToHtml2(Clr: TColor): string;
begin
  Result := IntToHex(clr, 6);
  Result := ´´ + Copy(Result, 5, 2) + Copy(Result, 3, 2) + Copy(Result, 1, 2);
end;



GOSTEI 0
POSTAR