Collapse the table of content
Expand the table of content


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 

[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.

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

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

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

	// Add "Home" category.
	// CMFCRibbonBar m_wndRibbonBar
	CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, 

Header: afxribbonbar.h

Community Additions

© 2015 Microsoft