Udostępnij za pośrednictwem


CMFCRibbonGalleryMenuButton Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCRibbonGalleryMenuButton Class.

Implements a ribbon menu button that contains ribbon galleries.

Syntax

class CMFCRibbonGalleryMenuButton : public CMFCToolBarMenuButton  

Members

Public Constructors

Name Description
CMFCRibbonGalleryMenuButton::CMFCRibbonGalleryMenuButton Constructs and initializes a CMFCRibbonGalleryMenuButton object.

Public Methods

Name Description
CMFCRibbonGalleryMenuButton::CopyFrom (Overrides CMFCToolBarMenuButton::CopyFrom.)
CMFCRibbonGalleryMenuButton::CreatePopupMenu (Overrides CMFCToolBarMenuButton::CreatePopupMenu.)
CMFCRibbonGalleryMenuButton::GetPalette
CMFCRibbonGalleryMenuButton::HasButton (Overrides CMFCToolBarMenuButton::HasButton.)
CMFCRibbonGalleryMenuButton::IsEmptyMenuAllowed (Overrides CMFCToolBarMenuButton::IsEmptyMenuAllowed.)

Remarks

The gallery menu button is displayed as a pop-up menu with an arrow. When the user clicks this button, a gallery of images is displayed. When you construct a gallery menu button, you must specify an image list that contains those images.

Example

The following example demonstrates how to display a gallery of bullets in a menu button:

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

 }  
}  

Inheritance Hierarchy

CObject CMFCToolBarButton CMFCToolBarMenuButton CMFCRibbonGalleryMenuButton

Requirements

Header: afxRibbonPaletteGallery.h

CMFCRibbonGalleryMenuButton::CopyFrom

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual void CopyFrom(const CMFCToolBarButton& src);

Parameters

[in] src

Remarks

CMFCRibbonGalleryMenuButton::CMFCRibbonGalleryMenuButton

Constructs and initializes a CMFCRibbonGalleryMenuButton object.

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

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

Parameters

uiID
The command ID of the button. This is the value sent in the WM_COMMAND message when the user clicks this button.

iImage
The index of the image to display with the gallery menu button. The images are stored in the imagesPalette parameter.

lpszText
The text to display on the menu button.

imagesPalette
Contains the list of images to display on the gallery.

uiImagesPaletteResID
The resource ID of the image list for the images to display on the gallery.

cxPaletteImage
Specifies the width in pixels of the image to display on the gallery.

Remarks

The gallery menu button is displayed as a pop-up menu that has an arrow. When the user clicks this button, a gallery of images is displayed.

Example

The following example demonstrates how to use the constructor of the CMFCRibbonGalleryMenuButton class. This code snippet is part of the MS Office 2007 Demo sample.

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

CMFCRibbonGalleryMenuButton::CreatePopupMenu

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual CMFCPopupMenu* CreatePopupMenu();

Return Value

Remarks

CMFCRibbonGalleryMenuButton::GetPalette

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

CMFCRibbonGallery& GetPalette();

Return Value

Remarks

CMFCRibbonGalleryMenuButton::HasButton

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL HasButton() const;  

Return Value

Remarks

CMFCRibbonGalleryMenuButton::IsEmptyMenuAllowed

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL IsEmptyMenuAllowed() const;  

Return Value

Remarks

See Also

Hierarchy Chart
Classes
CMFCToolBarMenuButton Class
CMFCRibbonGallery Class