CBrush m_HollowBrush; // CSign2Dlg::CSign2Dlg(CWnd* pParent /*=NULL*/) : CDialog(CSign2Dlg::IDD, pParent) { VERIFY(m_HollowBrush.CreateStockObject(HOLLOW_BRUSH)); } /// HBRUSH CSign2Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: 在此更改 DC 的任何特性 if(nCtlColor == CTLCOLOR_DLG || nCtlColor == CTLCOLOR_BTN || nCtlColor == CTLCOLOR_STATIC) { TCHAR lpszClassName[255]; GetClassName(pWnd-> m_hWnd, lpszClassName, 255); if(_tcscmp(lpszClassName, TRACKBAR_CLASS) == 0) return CDialog::OnCtlColor(pDC, pWnd, nCtlColor); //pDC-> SetBkMode(TRANSPARENT); pDC->SetBkColor(RGB(255,255,255)); return HBRUSH(m_HollowBrush); } // TODO: 如果默认的不是所需画笔,则返回另一个画笔 return hbr; }