Board index » delphi » TColor Hex Values

TColor Hex Values

I attempted to convert TColor (extracted from TColorDialog.Color property)
to its Hex values using both IntToHex and Format functions.  However, in
both cases it gave me the WRONG color hex value (so far it is always a
different shade of blue??).  Is this a bug or is it something with the way I
use the IntToHex or Format function??

Format( '$%.6X', [ColorDialog1.Color])
IntToHex(ColorDialog1.Color, 6)

 

Re:TColor Hex Values


Quote
Jared Chan wrote in message <3af13651$1_2@dnews>...
>I attempted to convert TColor (extracted from TColorDialog.Color
property)
>to its Hex values using both IntToHex and Format functions.  However,
in
>both cases it gave me the WRONG color hex value (so far it is always a
>different shade of blue??).  Is this a bug or is it something with the
way I
>use the IntToHex or Format function??

>Format( '$%.6X', [ColorDialog1.Color])
>IntToHex(ColorDialog1.Color, 6)

Both work fine for me. I get FF0000 for blue, 0000FF for red, etc.

--
Wayne Niddery (WinWright Inc.)
RADBooks - http://members.home.net/wniddery/RADBooks/delphibooks.html
"At the apex of every great tragedy of mankind there stands the figure
of an incorruptible altruist" - Ayn Rand

Re:TColor Hex Values


On Thu, 3 May 2001 20:47:32 +1000, "Jared Chan"

Quote
<vonloui...@hotmail.com> wrote:
>I attempted to convert TColor (extracted from TColorDialog.Color property)
>to its Hex values using both IntToHex and Format functions.  However, in
>both cases it gave me the WRONG color hex value (so far it is always a
>different shade of blue??).  Is this a bug or is it something with the way I
>use the IntToHex or Format function??

>Format( '$%.6X', [ColorDialog1.Color])
>IntToHex(ColorDialog1.Color, 6)

You have to use 8 hex digits to represent a color if you're also using
the TColor color constants (clXXX).

Jan

Other Threads