Re: How to get rid of constant color names for colordialog customcolors
- From: "alanglloyd@xxxxxxx" <alanglloyd@xxxxxxx>
- Date: 24 Oct 2006 03:51:17 -0700
On Oct 24, 10:15 am, HanslH <n...@xxxxx> wrote:
delphi4
I want the custom colors in a color dialog to represent the colors
that are currently used in my application.
Since colordialog has a customcolors properties that's a tiny easy
little job.
Not.
The colors of my appliaction are stored in the registry as strings
with colortostr. Alas some colors are among the main constant named
colors and stored as such ('clwhite')
The colordialog only accepts customcolors as a stringlist as
'colora=$xxxxxxxx'
'colorb=$xxxxxxxx'
'colora=clWhite' is joyfully puked out
I cannot come up with anyway to get rid of these constant names. I've
been looking at identtocolor strtocolor etc functions.
It seems rather annoying that delphi sticks to these constant names
but on the other hand the dialog rejects them. But it must be
something i'm overlooking. Please put me out of my misery.
Use IdentToColor() function (and any other similar color transform
functions - see Help).
Something like ...
ColorValStr := '$ffffff; // or ColorValStr := clWhite;
if IdenttoColor(ColorValStr, ColorInt) then
CustColorValStr := Format('$8.8x', [ColorInt])
else
CustColorValStr := ColorValStr;
ColorDialog1.CustomColors.Add('ColorA=' + CustColorValStr);
Alan Lloyd
.
- Follow-Ups:
- References:
- Prev by Date: How to get rid of constant color names for colordialog customcolors
- Next by Date: Re: How to get rid of constant color names for colordialog customcolors
- Previous by thread: How to get rid of constant color names for colordialog customcolors
- Next by thread: Re: How to get rid of constant color names for colordialog customcolors
- Index(es):
Relevant Pages
|