CButton is an MFC class (the reason that you are getting
confusing answers is that you posted in a .NET forum).
To get a custom-colored button in MFC you will have to
owner-draw it. Basically instead of leaving it up to the
system to draw the button for you, you will do it
yourself. Relax, it's not as hard as it sounds.
Basically you will just need to set the BS_OWNERDRAW style
(do this in your call to Create), and then override
DrawItem. There are a lot of utility methods that are
available to you that will draw whichever parts of the
button that you don't want to override, check out this
example for some pointers in the right direction:
http://msdn.microsoft.com/library/default.asp? url=/library/en-us/wcemfc/htm/cbutton_4.asp
(in the future, MFC questions would be better posted in
the vc.mfc newsgroup)
~ Andrew
[quoted text, click to view] >-----Original Message-----
>Hi, Thank you so much for your answers. I'm using C++. I
>guess the controls are a bit different from VB, because
>CButton does not have a .BackColor option (or anything
>else like it). I'm now using the custom control option to
>create a CStatic control, but it seems like there's no
>function to specify its color either.
>
>Marium
>.
[quoted text, click to view] "Marium A." <examiners@yahoo.com> wrote in message
news:029301c34c86$1d06a810$a101280a@phx.gbl...
> Hi, Thank you so much for your answers. I'm using C++. I
> guess the controls are a bit different from VB, because
> CButton does not have a .BackColor option (or anything
> else like it). I'm now using the custom control option to
> create a CStatic control, but it seems like there's no
> function to specify its color either.
>
> Marium
I'm glad we got that clarified, and that you've received a good answer from
Andrew. FWIW, it's not a C++ vs. VB difference, but a MFC vs. .NET framework
difference. The procedure I described can be done with equal ease in .NET
VB, C# or C++ (in the .NET 2003 Windows Form project template).