【MFC系列-第32天】控件自绘技术
32.1 对话框背景设置
方法一
BOOL CClDlg::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(rect);
pDC->FillSolidRect(rect, RGB(200, 255, 255));
return TRUE;
}
方法二:WM_CTRLCOLOR消息
按类型按句柄按控件ID
HBRUSH CMFCApplication1Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
TRACE("nID = %d/n",pWnd ->GetDlgCtrlID());
if (this->GetSafeHwnd() == pWnd->GetSaf
共有 0 条评论