相关主题 |
1. 用纯色 设置对话对话框的背景色 2. 3. |
对话框背景色 |
其他相关 CColorDialog |
代码::用纯色 设置对话对话框的背景色 |
HBRUSH { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any CBrush cbrush(RGB(255,0,0)); CRect crect; GetClientRect(crect); pDC->SelectObject(&cbrush); pDC->FillRect(crect,&cbrush); return cbrush; // TODO: Return a different return hbr; } 效果图 有个现象当单击1个按钮时 |
代码::用位图 |
resources 导入1个bitmap位图 // mfcDlg.h : header file // Implementation protected: HICON m_hIcon; CBrush m_BKBrush;//画刷 ::OnInitDialog() // TODO: Add extra initialization here CBitmap* pBitmap = new CBitmap; ASSERT(pBitmap); pBitmap->LoadBitmap(IDB_BITMAP1);//载入位图资源 m_BKBrush.CreatePatternBrush(pBitmap);//创建位图画刷 delete pBitmap; ::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) // TODO: Change any attributes of the DC here if (nCtlColor == CTLCOLOR_DLG ) return (HBRUSH)m_BKBrush.GetSafeHandle(); //返回创建的位图画刷 // TODO: Return a different brush if the default is not desired 效果图 |
关联picDialog
Shape
C++ BackColor_Dialog,布布扣,bubuko.com