Computer/Delphi
TColor 값을 HTML color 로 변경하는 코드
Gu Youn
2003. 5. 14. 11:19
출처 : http://community.borland.com/article/0,1410,16878,00.html
개념 : TColor값을 ColorToRGB 함수를 이용해서 rgb값으로 변경한후 RGB 순으로 조합한다.
소스 :
procedure TForm1.Button1Click(Sender: TObject);
var
TheRgbValue : TColorRef;
begin
if ColorDialog1.Execute then begin
TheRgbValue := ColorToRGB(ColorDialog1.Color);
ShowMessage(Format('%.2x%.2x%.2x',
[GetRValue(TheRGBValue),
GetGValue(TheRGBValue),
GetBValue(TheRGBValue)]));
end;
end;
var
TheRgbValue : TColorRef;
begin
if ColorDialog1.Execute then begin
TheRgbValue := ColorToRGB(ColorDialog1.Color);
ShowMessage(Format('%.2x%.2x%.2x',
[GetRValue(TheRGBValue),
GetGValue(TheRGBValue),
GetBValue(TheRGBValue)]));
end;
end;