设置对话框(Dialog)的背景色

重载WM_CTLCOLOR响应函数  
  HBRUSH   CDlgTest::OnCtlColor(CDC*   pDC,   CWnd*   pWnd,   UINT   nCtlColor)    
  {  
  //HBRUSH   hbr   =   CDialog::OnCtlColor(pDC,   pWnd,   nCtlColor);  
   
  //   TODO:   Change   any   attributes   of   the   DC   here  
  switch   (nCtlColor)  
  {  
  case   CTLCOLOR_DLG:  
  {  
      CBrush*           back_brush;  
      COLORREF         color;  
      color   =   RGB(255,255,255);  
      back_brush   =   new   CBrush(color);  
      return   (HBRUSH)   (back_brush->m_hObject);  
  }  
  }  
  return(CDialog::OnCtlColor(pDC,   pWnd,   nCtlColor));  
  //   TODO:   Return   a   different   brush   if   the   default   is   not   desired  
  //return   hbr;  
  }

你可能感兴趣的:(设置对话框(Dialog)的背景色)