Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CWnd::OnCtlColor
CWnd                                        Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  afx_msg HBRUSH OnCtlColor( CDC*  pDC, CWnd*  pWnd, UINT nCtlColor  );
 
  Parameter   Description
 
  <pDC>       Contains a pointer to the display context for the child
              window. May be temporary.
 
  <pWnd>      Contains a pointer to the child CWnd. May be temporary.
 
  <nCtlColor> Contains one of the following values, specifying the type of
              control:
 
              Value                Meaning
              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
 
  Remarks
 
  Called when a child system-defined control class or a message box is
  about to be drawn. The following controls call OnCtlColor:
 
  Combo boxes     Buttons
 
  Edit controls   Static controls
 
  List boxes      Scroll bars
 
  To change the background color of a single-line edit control, you must
  set the brush handle in both the CTLCOLOR_EDIT and CTLCOLOR_MSGBOX
  message codes, as well as calling the SetBkColor Windows function in
  response to the CTLCOLOR_EDIT code.
 
  The return value from the function has no effect on a button with the
  BS_PUSHBUTTON or BS_DEFPUSHBUTTON style.
 
  This message-handler member function calls the Default member
  function. Override this member function in your derived class to handle
  the WM_CTLCOLOR message.
 
  Return Value
 
  OnCtlColor must return a handle to the brush that is to be used for
  painting the control background, or it must return NULL.
 
  See Also
 
  CDC::SetBkColor, WM_CTLCOLOR, CWnd::Default
 
 
                                     -♦-