共用方式為


CMFCRibbonGalleryMenuButton 類別

實作包含功能區組件庫的功能區功能表按鈕。 如需詳細資訊,請參閱 Visual Studio 安裝的 VC\atlmfc\src\mfc 資料夾中的原始程式碼

語法

class CMFCRibbonGalleryMenuButton : public CMFCToolBarMenuButton

成員

公用建構函式

名稱 描述
CMFCRibbonGalleryMenuButton::CMFCRibbonGalleryMenuButton 建構並初始化 CMFCRibbonGalleryMenuButton 物件。

公用方法

名稱 描述
CMFCRibbonGalleryMenuButton::CopyFrom (覆寫 CMFCToolBarMenuButton::CopyFrom .)
CMFCRibbonGalleryMenuButton::CreatePopupMenu (覆寫 CMFCToolBarMenuButton::CreatePopupMenu .)
CMFCRibbonGalleryMenuButton::GetPalette
CMFCRibbonGalleryMenuButton::HasButton (覆寫 CMFCToolBarMenuButton::HasButton。)
CMFCRibbonGalleryMenuButton::IsEmptyMenuAllowed (覆寫 CMFCToolBarMenuButton::IsEmptyMenuAllowed .)

備註

組件庫功能表按鈕會顯示成含箭頭的快顯功能表。 當使用者按一下此按鈕時,會顯示影像庫。 當您建構組件庫功能表按鈕時,您必須指定包含這些影像的影像清單。

範例

下列範例示範如何顯示功能表按鈕中項目符號的組件庫:

BOOL CMainFrame::OnShowPopupMenu (CMFCPopupMenu* pMenuPopup)
{
    int nBulletIndex = pMenuBar->CommandToIndex (ID_PARA_BULLETS);

    if (nBulletIndex>= 0)
    {
        CMFCToolBarButton* pExButton =
        pMenuBar->GetButton(nBulletIndex);
        ASSERT_VALID (pExButton);

        CMFCRibbonGalleryMenuButton paletteBullet (
        pExButton->m_nID,
        pExButton->GetImage (),
        pExButton->m_strText);

        InitBulletPalette (&paletteBullet.GetPalette ());

        pMenuBar->ReplaceButton (ID_PARA_BULLETS,
        paletteBullet);
    }
}

繼承階層架構

CObject
\ CMFCToolBarButton
 \ CMFCToolBarMenuButton
  \ CMFCRibbonGalleryMenuButton

需求

標頭: afxRibbonPaletteGallery.h

CMFCRibbonGalleryMenuButton::CopyFrom

virtual void CopyFrom(const CMFCToolBarButton& src);

參數

[in] Src

備註

CMFCRibbonGalleryMenuButton::CMFCRibbonGalleryMenuButton

建構和初始化 CMFCRibbonGalleryMenuButton 物件。

CMFCRibbonGalleryMenuButton(
    UINT uiID,
    int iImage,
    LPCTSTR lpszText,
    CMFCToolBarImages& imagesPalette);

CMFCRibbonGalleryMenuButton(
    UINT uiID,
    int iImage,
    LPCTSTR lpszText,
    UINT uiImagesPaletteResID = 0,
    int cxPaletteImage = 0);

參數

uiID
按鈕的命令識別碼。 當使用者按一下此按鈕時,這是在WM_COMMAND訊息中傳送的值。

iImage
要與資源庫功能表按鈕一起顯示的影像索引。 影像會儲存在 imagesPalette 參數中

lpszText
要顯示在功能表按鈕上的文字。

imagesPalette
包含要顯示在資源庫上的影像清單。

uiImagesPaletteResID
要顯示在資源庫上之影像之影像清單的資源識別碼。

cxPaletteImage
指定要在資源庫上顯示之影像的圖元寬度。

備註

資源庫功能表按鈕會顯示為具有箭號的快顯功能表。 當使用者按一下此按鈕時,會顯示影像庫。

範例

下列範例示範如何使用 類別的 CMFCRibbonGalleryMenuButton 建構函式。 此程式碼片段是 MS Office 2007 示範範例 一部分。

// CMFCToolBarButton pExButton
CMFCRibbonGalleryMenuButton paletteBullet(pExButton->m_nID, pExButton->GetImage(), pExButton->m_strText);

CMFCRibbonGalleryMenuButton::CreatePopupMenu

virtual CMFCPopupMenu* CreatePopupMenu();

傳回值

備註

CMFCRibbonGalleryMenuButton::GetPalette

CMFCRibbonGallery& GetPalette();

傳回值

備註

CMFCRibbonGalleryMenuButton::HasButton

virtual BOOL HasButton() const;

傳回值

備註

CMFCRibbonGalleryMenuButton::IsEmptyMenuAllowed

virtual BOOL IsEmptyMenuAllowed() const;

傳回值

備註

另請參閱

階層架構圖表
類別
CMFCToolBarMenuButton 類別
CMFCRibbonGallery 類別