Change background color of CButton 
Author Message
 Change background color of CButton


could someone explain me how to change the background color of CButtons?

I have tried several ways but without success.


Mon, 12 Mar 2001 03:00:00 GMT  
 Change background color of CButton
Use the WM_CTLCOLOR-message.

Mon, 12 Mar 2001 03:00:00 GMT  
 Change background color of CButton

I couldn't get onctlcolor to work for buttons but there is some free code at that I downloaded for colored buttons and it works well.

Mon, 12 Mar 2001 03:00:00 GMT  
 Change background color of CButton


>Use the WM_CTLCOLOR-message.

Override OnCtlColor() in the button's parent window, check that it is a
button being drawn (it is called once for each child control) and then use
SetBkColor() to change the button's text background colour (or use
SetBkMode(TRANSPARENT) if you just want to leave the background intact, for
a bitmap brush, say) and return the handle of a brush of the required
background colour for parts NOT covered by text (make sure the brush doesn't
go out of scope after OnCtlColor() returns - maintain it as a member
variable of your parent window's class).

Does this help?

_ _
o o   Jason Teagle

Please ONLY respond via e-mail if you want to catch my attention - I don't
necessarily look at the newsgroups all the time.

Tue, 13 Mar 2001 03:00:00 GMT  
 [ 4 post ] 

 Relevant Pages 

1. Change CButton color and CButton text color in CDialog

2. Change background and text color in CButton

3. CButton - change background color problem

4. set the text color and the background color of a Control Cbutton

5. Changing the Background Color of a Dialog to match the background of a Bitmap

6. Change text color and background color in CEditView

7. Background Color of CButton

8. Change a part of Background color or a part of text color from CListCtrl

9. Setting background color of a CButton?

10. Win2K: static background color vs. CFormView background color

11. Change Color of CButton, CEdit and so on

12. how do I change the color of CButton???


Powered by phpBB® Forum Software