HBRUSH CControlTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (nCtlColor == CTLCOLOR_STATIC)
{
pDC->SetTextColor(RGB(255, 0, 0)); //设置字体颜色
pDC->SetBkMode(TRANSPARENT); //设置背景透明
}
else if (nCtlColor == COLOR_BTNTEXT)
{
pDC->SetTextColor(RGB(0, 0, 255)); //设置字体颜色
}
else if (nCtlColor == CTLCOLOR_EDIT)
{
pDC->SetTextColor(RGB(0, 0, 255)); //设置字体颜色
}
return hbr;
设置MFC常用控件颜色
最新推荐文章于 2023-06-21 17:52:50 发布