- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Converting a color to its VCL string value

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;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile