Graphics单元中 TColor 的定义
TColor = -$7FFFFFFF-1..$7FFFFFFF;
TColor实际上就是整型,所以可以用InttoHex转换成十六进制的字符串,如上面的例子
ShowMessage('#'+InttoHex(ColorDialog.Color,6)); //返回#000000
而 ColorToString,看看Delphi中关于它的帮助就一清二楚了[]
Call ColorToString to obtain a string that represents a TColor value. If there is a symbolic constant defined for the color (such as clBlack or clHighlightText), ColorToString returns the name of the constant. Otherwise, ColorToString returns the hex value of the color, formatted as a string such as "$02FF8800" (Delphi) or "0x02FF8800" (C++).