Главная страница | назад





Article #15836: Converting a color to its VCL string value

 Question and Answer Database
FAQ836D.txt Converting a color to its VCL string value
Category :VCL
Platform :All
Product :All 32 bit
Question:
How can I convert a color to its VCL string value?
Answer:
The graphics.pas file has a ColorToString() function that will
convert a valid TColor value to it's string representation using a
predefined constant (if possible) or a hexadecimal string. The
StringToColor() function provides the reciprocal function, taking a
predefined color constant string or hexadecimal string and returning
the TColor value.
Example:
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Add(ColorToString(clRed));
Memo1.Lines.Add(IntToStr(StringToColor('clRed')));
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99