Dela via


CMFCToolBarButton::OnCtlColor

Called by the framework when the parent toolbar handles a WM_CTLCOLOR message.

virtual HBRUSH OnCtlColor(
   CDC* pDC,
   UINT nCtlColor
);

Parameters

  • [in] pDC
    The device context that displays the button.

  • [in] nCtlColor
    The specific color notification.

Return Value

A handle to the brush object that the framework uses to paint the background of the button.

Remarks

The framework calls this method when the parent toolbar processes the WM_CTLCOLOR message for a toolbar button that contains a Windows control. The framework does not call this method if the toolbar button is windowless.

The framework calls this method when the toolbar framework is in customization mode and the toolbar button is unlocked. For more information about customization mode, see CMFCToolBar::SetCustomizeMode. For more information about locking toolbar buttons, see CMFCToolBarButton::IsLocked.

The default implementation does nothing and returns NULL.

Requirements

Header: afxtoolbarbutton.h

See Also

Concepts

MFC Hierarchy Chart

Reference

CMFCToolBarButton Class

CMFCToolBar::SetCustomizeMode

CMFCToolBarButton::IsLocked