共用方式為


CToolBarCtrl::SetColorScheme

Sets the color scheme of the current toolbar control.

void SetColorScheme(
          const COLORSCHEME* lpColorScheme
);

Parameters

Parameter

Description

[in] lpColorScheme

Pointer to a COLORSCHEME structure that describes the highlight color and shadow color of the toolbar control.

Remarks

This method has no effect if a Windows Vista visual theme is set.

This method sends the TB_SETCOLORSCHEME message, which is described in the Windows SDK.

Requirements

Header: afxcmn.h

Example

The following code example sets the color scheme for the current toolbar control. The code example makes the left and top edges of each tool button red and the right and bottom edges blue. When the user presses the button, the button's red edges turn blue and its blue edges turn red.

    //Set color scheme for the current toolbar control. 
    //Make the left and top edges of the tool button red, 
    //and the right and bottom edges blue. The colors 
    //reverse when a button is pressed.
    //This method has no effect if the Vista visual theme 
    //is set.
    {
    COLORSCHEME cs;
    cs.dwSize = sizeof(COLORSCHEME);
    cs.clrBtnHighlight = RGB( 255, 0, 0 );
    cs.clrBtnShadow    = RGB( 0, 0, 255 );
    CToolBarCtrl& m_toolBarCtrl = m_wndToolBar.GetToolBarCtrl();
    m_toolBarCtrl.SetColorScheme( &cs );
    }

See Also

Concepts

CToolBarCtrl Class

CToolBarCtrl Members

Hierarchy Chart

TB_SETCOLORSCHEME

COLORSCHEME

CToolBarCtrl::GetColorScheme