Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content


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) 

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

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

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

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.
	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, 

Header: afxribbonbar.h

© 2015 Microsoft