본문 바로가기

개발관련/MFC

OnCtlColor

in msdn...

afx_msg HBRUSH OnCtlColor(
CDC* pDC,
CWnd* pWnd,
UINT nCtlColor ); 

Parameters

pDC
Contains a pointer to the display context for the child window. May be temporary.
pWnd
Contains a pointer to the control asking for the color. May be temporary.
nCtlColor
Contains one of the following values, specifying the type of control:
  • CTLCOLOR_BTN   Button control
  • CTLCOLOR_DLG   Dialog box
  • CTLCOLOR_EDIT   Edit control
  • CTLCOLOR_LISTBOX   List-box control
  • CTLCOLOR_MSGBOX   Message box
  • CTLCOLOR_SCROLLBAR   Scroll-bar control
  • CTLCOLOR_STATIC   Static control


my source

OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
     HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

     pDC->SetBkMode(TRANSPARENT);    
     hbr = ::CreateSolidBrush(RGB(255,255,255));     // color to white
     return hbr;
}