Mega Code Archive

 
Categories / Delphi / Graphic
 

Color to string and vice versa

Title: Color to string and vice versa Use StringToColor and ColorToString functions. These functions are undocumented and contained in graphics module. Notes: ColorToString - if value has a special name, then this name will be display. For example, $FFFFFF - is a clWhite. StringToColor - you may use name of color here. For example, Str:='clYellow'. procedure TForm1.Button1Click(Sender: TObject); var Str:string; begin Str:='$AC142F'; Form1.Color:=StringToColor(Str); end; procedure TForm1.Button2Click(Sender: TObject); begin Label1.Caption:=ColorToString($FFFFFF); end;