一个很怪异的问题!
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;}