// TODO: Change any attributes of the DC here
if((pWnd->GetDlgCtrlID()==IDC_CHECK1/*换成你的复选框的ID*/))
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(255, 255, 0)); //设置颜色
return HBRUSH(GetStockObject(HOLLOW_BRUSH));
}
// TODO: Return a different brush if the default is not desired
// TODO: Return a different brush if the default is not desired
return hbr;
}
字体大小:获得复选框的指针,然后SetFont()就可以吧.我没试过.
HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// Call the base class implementation first! Otherwise, it may
// undo what we're trying to accomplish here.
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// Are we painting the IDC_CHECK1 control? We can use
// CWnd::GetDlgCtrlID() to perform the most efficient test.
if (pWnd->GetDlgCtrlID() == IDC_CHECK1)
{
// Set the text color to red
//pDC->SetTextColor(RGB(255, 0, 0));
// Set the background mode for text to transparent
// so background will show thru.
pDC->SetBkMode(TRANSPARENT);
// TODO: Change any attributes of the DC here
if((pWnd->GetDlgCtrlID()==IDC_CHECK1/*换成你的复选框的ID*/))
{
pDC->SetBkMode(TRANSPARENT);
return HBRUSH(GetStockObject(HOLLOW_BRUSH));
}
// TODO: Return a different brush if the default is not desired
// TODO: Return a different brush if the default is not desired
return hbr;
}
我试了,这样应该是可以的.刚才发给你的,让你判断了CTLCOLOR_EDIT是没有必要的.对不起.
// TODO: Change any attributes of the DC here
if(((pWnd->GetDlgCtrlID()==IDC_CHECK/*换成你的复选框的ID*/))
{
pDC->SetBkMode(TRANSPARENT);
return HBRUSH(GetStockObject(HOLLOW_BRUSH));
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
这样行不行?
// TODO: Change any attributes of the DC here
if((nCtlColor == CTLCOLOR_EDIT) && (pWnd->GetDlgCtrlID()==IDC_CHECK/*换成你的复选框的ID*/))
{
pDC->SetBkMode(TRANSPARENT);
return HBRUSH(GetStockObject(HOLLOW_BRUSH));
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
试试这样行不行.