Re: How do I change the color of a button in a dialog?
- From: "Dov Aharonson" <dov@xxxxxxxxxxx>
- Date: Wed, 18 Jan 2006 14:02:01 +0200
The problem is that I would like MFC to handle the drawing of the buttons
control on my dialog, I only wish to change the button control color.
I have my dialog class derived from CDialog, in this class I have-
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
In which I analyze the dialog items such as EDIT controls or BUTTON controls
and set the colors for some of them by modifying the returned brush, or by
calling-
pDC->SetBkColor(..)
pDC->SetTextColor(..) etc.
It does work fine with EDIT control but does not affect the BUTTON
control!!!
What should be done?
"William DePalo [MVP VC++]" <willd.no.spam@xxxxxxxx> wrote in message
news:u%23%23aiz6GGHA.3936@xxxxxxxxxxxxxxxxxxxxxxx
> "Dov Aharonson" <dov@xxxxxxxxxxx> wrote in message
> news:OXrzKo6GGHA.312@xxxxxxxxxxxxxxxxxxxxxxx
>>I need to change the color of a button in a dialog box in runtime as a
>>result of user interaction with the program.
>>
>> Help is greatly appreciated
>
> Mark the button as owner drawn and respond to the message WM_CTLCOLORBTN
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/buttons/buttonreference/buttonmessages/wm_ctlcolorbtn.asp
>
> Regards,
> Will
>
>
.
- Follow-Ups:
- Re: How do I change the color of a button in a dialog?
- From: William DePalo [MVP VC++]
- Re: How do I change the color of a button in a dialog?
- References:
- How do I change the color of a button in a dialog?
- From: Dov Aharonson
- Re: How do I change the color of a button in a dialog?
- From: William DePalo [MVP VC++]
- How do I change the color of a button in a dialog?
- Prev by Date: Re: size grip in dialog boxes
- Next by Date: Re: manifest screws up toolbar save/restore
- Previous by thread: Re: How do I change the color of a button in a dialog?
- Next by thread: Re: How do I change the color of a button in a dialog?
- Index(es):
Relevant Pages
|