.h:
CMyButton m_Radio_NoFill;
CButton m_Radio_PurecolourFill;
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
cpp:
HBRUSH CMyFillDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CXTPPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: 在此更改 DC 的任何属性
// TODO: 如果默认的不是所需画笔,则返回另一个画笔
switch(pWnd->GetDlgCtrlID())
{
case IDC_STATIC:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,0)); //设置背景色
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
case IDC_RADIO_NoFill: //控件的ID
case IDC_RADIO_PurecolourFill: //控件的ID
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)GetStockObject(NULL_BRUSH); //设置背景透明
break;
default:
break;
}
return hbr;
}