Partager via


CMFCRibbonBar::AddMainCategory

Creates a new main ribbon category for the ribbon bar.

CMFCRibbonMainPanel* AddMainCategory(
   LPCTSTR lpszName,
   UINT uiSmallImagesResID,
   UINT uiLargeImagesResID,
   CSize sizeSmallImage = CSize(16, 16),
   CSize sizeLargeImage = CSize(32, 32) 
);

Parameters

  • [in] lpszName
    Name of the main ribbon category.

  • [in] uiSmallImagesResID
    Resource ID of small images.

  • [in] uiLargeImagesResID
    Resource ID of large images.

  • [in] sizeSmallImage
    The size of small images.

  • [in] sizeLargeImage
    The size of large images.

Return Value

Pointer to the new main ribbon category if the method was successful; otherwise, NULL.

Remarks

If a main ribbon category already exists, it is deleted.

Example

The following example demonstrates how to use the AddMainCategory method in the CMFCRibbonBar class.

    // m_wndRibbonBar is declared as a protected member variable 
    // CMFCRibbonBar m_wndRibbonBar.
    // strTemp is a CString variable.
    strTemp.LoadString(IDS_RIBBON_FILE);
    CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, 
        IDB_FILESMALL, IDB_FILELARGE);

Requirements

Header: afxribbonbar.h

See Also

Reference

CMFCRibbonBar Class

Hierarchy Chart