怎样让在OnPaint中设置的对话框背景色和静态文本,编辑框等控件的背景色一致,这样看起来才协调

HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
 
// HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
 // TODO: Change any attributes of the DC here
 
 // TODO: Return a different brush if the default is not desired
 
 // TODO: Change any attributes of the DC here

     HBRUSH hbr=(HBRUSH)::GetStockObject(NULL_BRUSH);
 if (CTLCOLOR_STATIC==nCtlColor)
 { 
  pDC->SetBkMode(TRANSPARENT);
  
  pDC->SetTextColor(RGB(25,25,255));
   
  
  
 }
 if (CTLCOLOR_BTN==nCtlColor ||CTLCOLOR_EDIT==nCtlColor)
 {   hbr =::CreateSolidBrush(RGB(255,255,255));
  pDC->SetBkMode(TRANSPARENT);
  pDC->SetTextColor(RGB(255,0,0));

 }
 // TODO: Return a different brush if the default is not desired

 return hbr;
}

你可能感兴趣的:(怎样让在OnPaint中设置的对话框背景色和静态文本,编辑框等控件的背景色一致,这样看起来才协调)