description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CMFCRibbonGalleryMenuButton Class |
CMFCRibbonGalleryMenuButton Class |
11/04/2016 |
|
|
4d459d9b-8b1a-4371-92f6-dc4ce6cc42c8 |
Implements a ribbon menu button that contains ribbon galleries. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
class CMFCRibbonGalleryMenuButton : public CMFCToolBarMenuButton
Name | Description |
---|---|
CMFCRibbonGalleryMenuButton::CMFCRibbonGalleryMenuButton | Constructs and initializes a CMFCRibbonGalleryMenuButton object. |
Name | Description |
---|---|
CMFCRibbonGalleryMenuButton::CopyFrom | (Overrides CMFCToolBarMenuButton::CopyFrom.) |
CMFCRibbonGalleryMenuButton::CreatePopupMenu | (Overrides CMFCToolBarMenuButton::CreatePopupMenu.) |
CMFCRibbonGalleryMenuButton::GetPalette | |
CMFCRibbonGalleryMenuButton::HasButton | (Overrides CMFCToolBarMenuButton::HasButton .) |
CMFCRibbonGalleryMenuButton::IsEmptyMenuAllowed | (Overrides CMFCToolBarMenuButton::IsEmptyMenuAllowed.) |
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.
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);
}
}
CObject
└ CMFCToolBarButton
└ CMFCToolBarMenuButton
└ CMFCRibbonGalleryMenuButton
Header: afxRibbonPaletteGallery.h
virtual void CopyFrom(const CMFCToolBarButton& src);
[in] src
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);
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.
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.
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.
[!code-cppNVC_MFC_MSOffice2007Demo#8]
virtual CMFCPopupMenu* CreatePopupMenu();
CMFCRibbonGallery& GetPalette();
virtual BOOL HasButton() const;
virtual BOOL IsEmptyMenuAllowed() const;
Hierarchy Chart
Classes
CMFCToolBarMenuButton Class
CMFCRibbonGallery Class