|
-
December 4th, 2003, 02:52 PM
#1
How to change the color of a button background
I am using a Class CxTargetButton for the buttons in my Dialog,
Now even afetr tryuing to use Message reflection, the background color of the buttons is not changing.
I can see the following method being called
HBRUSH CxTargetButton::CtlColor(CDC* p_DC, UINT nCtl)
{
p_DC->SetBkColor(RGB(255,255,255));
p_DC->SetTextColor(RGB(255,0,0));
return (HBRUSH)m_Brush;
}
But the background color is not changed to white as I want it to.
The method DrawItem has been overridden in the class, can that be causing this issue...
Pauli
-
December 4th, 2003, 03:21 PM
#2
I have some other controls there as well..
And I have tried the same for them but still nothing, they have the same grey background.
I am changing the background color of the Dialog in the dialogs CTLColor handler, and for rest of the controlls using CTLCOLOR reflection am trying to use CtlColor to change the color
-
December 6th, 2003, 02:43 AM
#3
For styled buttons of all types, I highly recommend using the
CButtonST class by Davide Calabro, at:
http://www.codeproject.com/buttonctrl/cbuttonst.asp
-
December 6th, 2003, 04:16 AM
#4
Can I ask what is CxTargetButton?
Anyway, depending on what this class does, you could just derive
from this class and handle DrawItem. Change the backgound color and then call the bass class implementation of DrawItem.
Again this depends on what this button class is.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
December 6th, 2003, 11:09 AM
#5
if you are using manifest (win XP style) the reflection functions won't change a thing.
i don't know why... i asked this question a half a year ago...
no one told me how to solve this... except one who told me about API functions...
i tried to change the color of CheckBox when i click on it.
See my thread...
InfraRed.
Please rate my post, if it helped you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|