Board index » delphi » RGB Hex values for TColor?

RGB Hex values for TColor?

Hi,

How can I get the Hex value out of an existing TColor object?

For example, I would like to let the user select a Color from a
TColorDialog.  Then I would like to store this color in my database.
The easiest way would be to store the Hex code, ala TColor($FF0000).
But I can't figure out how to extract the hex code.

Thanks,
*:> Scott

--
--------------------------------------------------------------
Scott Metzger
Software Engineer
Cambio, Inc. - Managing Your Changing Network
http://www.cambio.com

 

Re:RGB Hex values for TColor?


I believe that the TColor is declared in Graphics.pas as a range of
values from -$7FFFFFFF to $7FFFFFFF and the clxxxx are just constant
declarations representing some of these values.  Hope this helps.

Quote
Scott Metzger wrote:
> Hi,

> How can I get the Hex value out of an existing TColor object?

> For example, I would like to let the user select a Color from a
> TColorDialog.  Then I would like to store this color in my database.
> The easiest way would be to store the Hex code, ala TColor($FF0000).
> But I can't figure out how to extract the hex code.

> Thanks,
> *:> Scott

> --
> --------------------------------------------------------------
> Scott Metzger
> Software Engineer
> Cambio, Inc. - Managing Your Changing Network
> http://www.cambio.com

--

-------------------------------------
Brian S. Goldberg
Systems Development & Integration
Medical Office Software, Inc.
mailto:Bri...@mosonline.com

Re:RGB Hex values for TColor?


TColor is an integer value (32 bits). You don't need to use string
representations, use the value instead.

Arthur

Scott Metzger escreveu na mensagem <38A32D1C.48571...@cambio.com>...

Quote
>Hi,

>How can I get the Hex value out of an existing TColor object?

>For example, I would like to let the user select a Color from a
>TColorDialog.  Then I would like to store this color in my database.
>The easiest way would be to store the Hex code, ala TColor($FF0000).
>But I can't figure out how to extract the hex code.

>Thanks,
>*:> Scott

>--
>--------------------------------------------------------------
>Scott Metzger
>Software Engineer
>Cambio, Inc. - Managing Your Changing Network
>http://www.cambio.com

Re:RGB Hex values for TColor?


Quote
Scott Metzger wrote...

<<
How can I get the Hex value out of an existing TColor object?

Quote

If you want to store it as string use something like this
  '$' + IntToHex(TColor, 4)
or
  Format( '$%.4X', [TColor])

- Pieter

Other Threads