共用方式為


CMFCRibbonPanel::SetElementRTCByID

將由功能區面板所提供的執行階段類別指定資訊的一個功能區項目。

CMFCRibbonBaseElement* SetElementRTCByID(
    UINT uiCmdID,
    CRuntimeClass* pRTC 
);

參數

  • [in] uiCmdID
    指定功能區項目加入的命令 ID。

  • pRTC
    對執行階段類別資訊的指標與加入至功能區面板的功能區項目。

傳回值

使用指定的執行階段類別資訊,建立的功能區項目。

備註

如果您要將自訂項目 (例如,色彩按鈕) 加入至功能區面板,您必須指定自訂項目的執行階段類別資訊。 功能區儲存資訊,建立自訂項目,並取代指定的命令 ID. 設定的現有項目 然後傳回指向這個新建立的項目。

範例

下列範例示範如何使用 SetElementRTCByID 方法:

// Load and add toolbar with standard buttons. This toolbar
// should display a custom color button with id ID_CHAR_COLOR:

pPanel->AddToolBar(IDR_MAINFRAME, IDB_MAINFRAME256);
CMFCRibbonColorButton* pColorButton =
    (CMFCRibbonColorButton*)pPanel->SetElementRTCByID(
    ID_CHAR_COLOR, RUNTIME_CLASS (CMFCRibbonColorButton));

// SetElementRTCByID sets runtime class and returns a pointer
// to the newly created custom button, which can be set up immediately:
pColorButton->EnableAutomaticButton(_T("Automatic"), RGB (0, 0, 0));

需求

標題: afxRibbonPanel.h

請參閱

參考

CMFCRibbonPanel 類別

階層架構圖表