Setting Button Color / Text WinApi WM_CTLCOLORBTN
How would I use WM_CTLCOLORBTN to set the background of a button? I tried using SetBkColor((HDC)wParam,RGB(#,#,#)) in this message but it has no effect. What else do I need to do?
Well, for starters, did you create the button as an owner-drawn button. Processing the WM_CTLCOLORBTN doesn't work if not.
If you haven't done so you might want to read this.
If you haven't done so you might want to read this.
yeah I used BS_OWNERDRAW. Petzolds book says you can do it from WM_COLORBTN but then there is no example of how to do it, although he says you have to use SetBkColor. Ive figured out how to do it with WM_DRAWITEM messages, but not with WM_CTLCOLORBTN.
edit: Ill just use WM_DRAWITEM
edit: Ill just use WM_DRAWITEM
When you process WM_CTLCOLORBTN, (in your WndProc, likely) you have to return a handle to a brush (HBRUSH)... the brush you want to paint the button's background with.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement