共用方式為


CToolBarCtrl::SetColorScheme

設定目前工具列控制項的色彩配置。

void SetColorScheme(
     const COLORSCHEME* lpColorScheme
);

參數

參數

描述

[in] lpColorScheme

為描述反白色彩和工具列控制項的陰影色彩的 COLORSCHEME 結構的指標。

備註

如果 Windows Vista 視覺化佈景主題設定,這個方法便沒有作用。

這個方法會將 TB_SETCOLORSCHEME 資訊,在 Windows SDK說明。

需求

標題: afxcmn.h

範例

下列程式碼範例會將目前的工具列控制項的色彩配置。 程式碼範例會使藍色左下邊緣和每個工具以紅色和右邊緣與的上邊緣。 當使用者按下按鈕時,按鈕的紅色邊緣會變成藍色,而且其藍色邊緣會變成紅色。

    //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 );
    }

請參閱

參考

CToolBarCtrl 類別

階層架構圖

TB_SETCOLORSCHEME

COLORSCHEME

CToolBarCtrl::GetColorScheme