Condividi tramite


CMFCRibbonButtonsGroup Class

The CMFCRibbonButtonsGroup class allows you to organize a set of ribbon buttons into a group. All buttons in the group are directly adjacent to each other horizontally and enclosed in a border.

class CMFCRibbonButtonsGroup : public CMFCRibbonBaseElement

Members

Public Constructors

Name

Description

CMFCRibbonButtonsGroup::CMFCRibbonButtonsGroup

 

Public Methods

Name

Description

CMFCRibbonButtonsGroup::AddButton

Adds a button to a group.

CMFCRibbonButtonsGroup::AddButtons

Adds a list of buttons to a group.

CMFCRibbonButtonsGroup::GetButton

Returns a pointer to the button that is located at a specified index.

CMFCRibbonButtonsGroup::GetCount

Returns the number of buttons in the group.

CMFCRibbonButtonsGroup::GetImageSize

Returns the image size of the ribbon element. (Overrides CMFCRibbonBaseElement::GetImageSize.)

CMFCRibbonButtonsGroup::GetRegularSize

Returns the regular size of the ribbon element. (Overrides CMFCRibbonBaseElement::GetRegularSize.)

CMFCRibbonButtonsGroup::HasImages

 

CMFCRibbonButtonsGroup::OnDrawImage

 

CMFCRibbonButtonsGroup::RemoveAll

 

CMFCRibbonButtonsGroup::SetImages

Assigns images to the group.

CMFCRibbonButtonsGroup::SetParentCategory

  (Overrides CMFCRibbonBaseElement::SetParentCategory.)

Remarks

The group is derived from CMFCBaseRibbonElement and can be manipulated as a single entity. You can position the group on any panel or popup menu.

Example

The following example demonstrates how to use various methods in the CMFCRibbonButtonsGroup class. The example shows how to construct a CMFCRibbonButtonsGroup object, assign images to the group of ribbon buttons, and add a button to the group of ribbon buttons. This code snippet is part of the Draw Client sample.

        CMFCRibbonButtonsGroup* pSBGroup = new CMFCRibbonButtonsGroup;

        CMFCToolBarImages images;
        images.SetImageSize(CSize(14, 14));
    
        CMFCToolBarImages hotimages;
        hotimages.SetImageSize(CSize(14, 14));
    
        if (images.Load(IDB_STATUSBAR_1) && hotimages.Load(IDB_STATUSBAR_2))
        {
            pSBGroup->SetImages(&images, &hotimages, NULL);
        }

        pSBGroup->AddButton(new CMFCRibbonButton(ID_FILE_PRINT_PREVIEW, _T(""), 0));
        pSBGroup->AddButton(new CMFCRibbonButton(ID_FILE_SUMMARYINFO, _T(""), 1));
        
        // CMFCRibbonStatusBar m_wndStatusBar
        m_wndStatusBar.AddExtendedElement(pSBGroup, _T("View Shortcuts"));

Inheritance Hierarchy

CObject

   CMFCRibbonBaseElement

      CMFCRibbonButtonsGroup

Requirements

Header: afxribbonbuttonsgroup.h

See Also

Reference

Hierarchy Chart

Other Resources

MFC Classes