I'm creating a managed VC++ .NET application that uses standard controls
(e.g., Form. RadioBox, Button, etc.). These use 'Color' as the type for such
things as ForeColor and BackColor. Many Colors are already provided (i.e.,
Black, Red, SeaGreen, etc.) as a convenience.
However, I can't seem to find out how to create my own custom colors. In the
VC++ GUI it seems to think I should be able to use the Color::Color(r,g,b)
constructor, in that it recognizes them in the editor (i.e., they show up as
'tool tips' when typing the Color constructors). But, when compiled, it says
these same constructors don't exist!
I want to do something like:
Color myColor( r, g, b ) ;
where 'r','g', and 'b' are the red green anf blue componenets of the color.
An alpha channel component ('a' in ARGB) would be nice, but not necessary.
Note that in theory the above should just work (assuming r,g, and b are
setup correctly), but it doesn't. I assume I can create my own colors, but
how?
PS - I have a similar problem with Fonts. How do I get a list of available
FontFamiy's for a particular machine so I can change a control's font to one
other than the default (and make sure it is available)?
Peteroid - 22 May 2004 05:04 GMT
There must be some way to create one's own Color's (again, the
constructors don't compile, why?). Do I need some header file I'm unaware
of? Does it require some dependency?
This should be a simple question, but no responses in days. Please help!
: )
> I'm creating a managed VC++ .NET application that uses standard controls
> (e.g., Form. RadioBox, Button, etc.). These use 'Color' as the type for
such
> things as ForeColor and BackColor. Many Colors are already provided
(i.e.,
> Black, Red, SeaGreen, etc.) as a convenience.
>
> However, I can't seem to find out how to create my own custom colors. In
the
> VC++ GUI it seems to think I should be able to use the
Color::Color(r,g,b)
> constructor, in that it recognizes them in the editor (i.e., they show
up as
> 'tool tips' when typing the Color constructors). But, when compiled, it
says
> these same constructors don't exist!
>
> I want to do something like:
>
> Color myColor( r, g, b ) ;
>
> where 'r','g', and 'b' are the red green anf blue componenets of the
color.
> An alpha channel component ('a' in ARGB) would be nice, but not
necessary.
>
> Note that in theory the above should just work (assuming r,g, and b are
> setup correctly), but it doesn't. I assume I can create my own colors,
but
> how?
>
> PS - I have a similar problem with Fonts. How do I get a list of
available
> FontFamiy's for a particular machine so I can change a control's font to
one
> other than the default (and make sure it is available)?