Change background and text color in CButton 
Author Message
 Change background and text color in CButton

This is a multi-part message in MIME format.
--------------D1F2B7EF5A9A76BB7A32E25E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Quote:

> I have a CButton embedded in a CWnd and I want to change the background
> color and text color.

> I have tried trapping WM_CTLCOLOR in the CWnd, but no messages go through.
> Do I have to override CButton to CMyButton::CButton and trap WM_CTLCOLOR
> there?
> --


See the http://www.*-*-*.com/
basically do your own drawing.. See this KB article ID: Q64328 "SAMPLE:
Owner-Draw: 3-D Push Button Made from Bitmaps with Text".

--
Girish Bharadwaj B.V.
Software Developer
http://www.*-*-*.com/ ~GBharadwaj/index.html


--------------D1F2B7EF5A9A76BB7A32E25E
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Girish Bharadwaj
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Girish Bharadwaj
n:              Bharadwaj;Girish
org:            PictureTel Corp.

title:          Software Developer
tel;work:       (508) 292 5897

x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
end:            vcard

--------------D1F2B7EF5A9A76BB7A32E25E--



Sat, 26 Feb 2000 03:00:00 GMT  
 Change background and text color in CButton

I have a CButton embedded in a CWnd and I want to change the background
color and text color.

I have tried trapping WM_CTLCOLOR in the CWnd, but no messages go through.
Do I have to override CButton to CMyButton::CButton and trap WM_CTLCOLOR
there?
--



Sat, 26 Feb 2000 03:00:00 GMT  
 Change background and text color in CButton

No, you have to do an owner-draw button.  There is no way to
programmatically just change the background color of a button
(although you can change the text color in the WM_CTLCOLOR handler).
Fortunately, owner-draw buttons are fairly easy, because of the
DrawEdge function.  A trick is that when the button is "depressed",
move the text right and down by SM_CXBORDER units (watch a "real"
button and you'll see this trick; I discovered it when I kept trying
to figure out why my owner-draw buttons didn't look "as good" as
standard buttons.
                        joe



Quote:
>I have a CButton embedded in a CWnd and I want to change the background
>color and text color.

>I have tried trapping WM_CTLCOLOR in the CWnd, but no messages go through.
>Do I have to override CButton to CMyButton::CButton and trap WM_CTLCOLOR
>there?

Joseph M. Newcomer

http://www3.pgh.net/~newcomer


Sun, 27 Feb 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Change CButton color and CButton text color in CDialog

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

3. Change text color and background color in CEditView

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

5. Change background color of CButton

6. CButton - change background color problem

7. Change Text color in CButton?

8. changing background color of the text

9. How to change background and text color of CPropertySheet

10. Changing Background Color of CEdit - Problem With Double Clicking On Texts

11. Changing the background color of a static text control

12. Change background color of selected text

 

 
Powered by phpBB® Forum Software