CMFCRibbonMainPanel Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCRibbonMainPanel Class.

Implements a ribbon panel that displays when you click the CMFCRibbonApplicationButton.

class CMFCRibbonMainPanel : public CMFCRibbonPanel  

Public Constructors

NameDescription
CMFCRibbonMainPanel::CMFCRibbonMainPanelDefault constructor.
CMFCRibbonMainPanel::~CMFCRibbonMainPanelDestructor.

Public Methods

NameDescription
CMFCRibbonMainPanel::AddAdds a ribbon element to the left pane of the application button panel. (Overrides CMFCRibbonPanel::Add.)
CMFCRibbonMainPanel::AddRecentFilesListAdds a text string to the recent files list menu.
CMFCRibbonMainPanel::AddToBottomAdds a ribbon element to the bottom pane of the ribbon application panel.
CMFCRibbonMainPanel::AddToRightAdds a ribbon element to the right pane of the application button panel.
CMFCRibbonMainPanel::CreateObjectUsed by the framework to create a dynamic instance of this class type.
CMFCRibbonMainPanel::GetCommandsFrameReturns a rectangle that represents the area of the ribbon main panel.
CMFCRibbonMainPanel::GetThisClassUsed by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.

The framework displays the CMFCRibbonMainPanel when you open the application panel. It contains three panes:

  • The left pane contains commands associated with files, such as Open, Save, Print, and Close. To add a command to this pane, call CMFCRibbonMainPanel::Add.

  • The right pane contains options that modify the command that you click in the left pane. For example, if you click Save As from the left pane, the right pane can display available file types. To add an item to this pane, call CMFCRibbonMainPanel::AddToRight.

  • The bottom pane contains buttons that allow you to change the application's settings and to exit the program. To add an item to this pane, call CMFCRibbonMainPanel::AddToBottom.

CObject

CMFCRibbonPanel

CMFCRibbonMainPanel

Header: afxRibbonMainPanel.h

Adds a ribbon element to the left pane of the application button panel.

virtual void Add(CMFCRibbonBaseElement* pElem);

Parameters

[in] [out] pElem
A pointer to the ribbon element to add to the main panel.

Remarks

Adds a ribbon element to the panel. Elements added using this method will be located in the left column of the main panel.

Adds a text string to the recent files list menu.

void AddRecentFilesList(
    LPCTSTR lpszLabel,  
    int nWidth = 300);

Parameters

lpszLabel
Specifies the string to add to the recent files list.

nWidth
Specifies the width, in pixels, of the recent files list panel.

Remarks

Adds a ribbon element to the bottom pane of the ribbon application panel.

void AddToBottom(CMFCRibbonMainPanelButton* pElem);

Parameters

[in] [out] pElem
A pointer to the ribbon element to add to the bottom of the main panel.

Remarks

Adds a ribbon element to the right pane of the application button panel.

void AddToRight(
    CMFCRibbonBaseElement* pElem,  
    int nWidth = 300);

Parameters

pElem
A pointer to a ribbon element to be added to the right side of the main panel.

nWidth
Specifies the width, in pixels, of the right panel.

Remarks

Use this function to add a ribbon element to the right panel. The right panel typically displays the recent files list, but you can add any other ribbon element here.

Returns a rectangle that represents the area of the ribbon main panel.

CRect GetCommandsFrame() const;  

Return Value

A rectangle that represents the area of the ribbon main panel.

Hierarchy Chart
Classes
CMFCRibbonPanel Class

Show: