15,978
社区成员
发帖
与我相关
我的任务
分享
CBrush m_brDents;
CBitmap m_bmDents;
m_brDents.DeleteObject();
m_bmDents.LoadBitmap(IDB_BAK); //导入背景图片
m_brDents.CreatePatternBrush(&m_bmDents); //保存窗体背景图片,供OnCtlColor()调用
HBRUSH CTreeDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(nCtlColor == CTLCOLOR_DLG)
{
pDC->SetBkMode(TRANSPARENT);
return m_brDents;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}