-
July 22nd, 2019, 02:57 PM
#1
Is there any straightforward way to change the background color of a check box?
I'm trying to change the white rectangle that makes up the background of the checkbox to gray like the surrounding color. However it seems that there is no easy way to do this. Is this even possible? I was told to try overriding #OnCtlColor# but I haven't been able to get that to work. My understanding of all things Windows and MFC is definitely lacking so my attempt could simply be wrong. I'm leaving for a moment soon but when I come back I can post the code of my attempt if that helps. Other than that, does anyone have any ideas / pointers to lead me in the right direction? Thanks.
-
July 23rd, 2019, 01:31 AM
#2
Re: Is there any straightforward way to change the background color of a check box?
Victor Nijegorodov
-
July 23rd, 2019, 07:08 AM
#3
Re: Is there any straightforward way to change the background color of a check box?
Code:
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
if(pWnd->GetDlgCtrlID() == IDC_MYBUTTON)
pDC->SetBkColor(RGB(255, 255, 255));
return hbr;
}
Tags for this Thread
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
|