Share via


CMFCRibbonBar::AddCategory

Creates and initializes a new ribbon category for the ribbon bar.

CMFCRibbonCategory* AddCategory(
   LPCTSTR lpszName,
   UINT uiSmallImagesResID,
   UINT uiLargeImagesResID,
   CSize sizeSmallImage = CSize(16, 16),
   CSize sizeLargeImage = CSize(32, 32),
   int nInsertAt = -1,
   CRuntimeClass* pRTI = NULL 
);

Parameters

  • [in] lpszName
    Name of the ribbon category.

  • [in] uiSmallImagesResID
    Resource ID of the small image list for the ribbon category.

  • [in] uiLargeImagesResID
    Resource ID of the large image list for the ribbon category.

  • [in] sizeSmallImage
    Specifies the size of small images for the ribbon category.

  • [in] sizeLargeImage
    Specifies the size of large images for the ribbon category.

  • [in] nInsertAt
    Zero based index of the category location.

  • [in] pRTI
    Pointer to a CMFCRibbonCategory Class run-time class to dynamically create a ribbon category at run-time.

Return Value

A pointer to the new ribbon category if the method was successful; otherwise, NULL.

Remarks

If the pRTI parameter is not NULL, the new ribbon category is created dynamically using the run-time class.

Example

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

    // Add "Home" category.
    // CMFCRibbonBar m_wndRibbonBar
    strTemp.LoadString(IDS_RIBBON_HOME);
    CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, 
        IDB_WRITESMALL, IDB_WRITELARGE);

Requirements

Header: afxribbonbar.h

See Also

Reference

CMFCRibbonBar Class

Hierarchy Chart