CMFCRibbonPanel Class
Implements a panel that contains a set of ribbon elements. When the panel is drawn, it displays as many elements as possible, given the size of the panel.
class CMFCRibbonPanel : public CObject
Members
Protected Constructors
Name |
Description |
---|---|
Constructs and initializes a CMFCRibbonPanel object. |
Public Methods
Name |
Description |
---|---|
Adds a ribbon element to the panel. |
|
Adds a separator to the ribbon panel. |
|
Adds a toolbar to the ribbon panel. |
|
Enables or disables the display of a launch button. |
|
|
|
Returns an element identified by a specified command ID. |
|
|
|
Returns the number of elements in the ribbon panel. |
|
Returns the user-defined data associated with the panel. |
|
|
|
|
|
Returns the ribbon element located at a specified index. |
|
Retrieves all elements that are contained in the ribbon panel. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns the parent category of the ribbon panel. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inserts a ribbon element at the given position. |
|
Inserts a separator at the given position. |
|
Specifies whether all panel elements should be centered (aligned) vertically, by column. |
|
|
|
|
|
Specifies whether all panel columns have the same width. |
|
|
|
|
|
|
|
|
|
Removes and optionally deletes an element located at the specified index. |
|
Removes all elements from the ribbon panel. |
|
Replaces one element with another based on their respective index values. |
|
Replaces one element with another based on a specified command ID. |
|
Orders the panel to align elements vertically, by column. |
|
Associates user-defined data with the ribbon panel. |
|
Assigns a popup menu to the element that has the given command ID. |
|
Adds a ribbon element specified by the provided runtime class information to the ribbon panel. |
|
Adds a ribbon element specified by the provided runtime class information to the ribbon panel. |
|
Enables or disables column justification. |
|
Sets the keyboard shortcut that displays the ribbon panel. |
|
|
Remarks
Ribbon panels are logical groupings of related tasks that you create within ribbon categories. As the size of the ribbon changes, the panel layout automatically adjusts to display as many elements as possible.
You can get a ribbon panels that is contained in a ribbon category by calling the CMFCRibbonCategory::GetPanel method.
Example
The following example demonstrates how to configure a CMFCRibbonPanel object by using various methods in the CMFCRibbonPanel class. The example shows how to set the keyboard shortcut that displays the ribbon panel, align elements in the panel vertically by column, enable column justification, and enable the display of the launch button. This code snippet is part of the MSOffice2007Demo Sample: MFC Office Application.
// CMFCRibbonCategory* pCategory
// CMFCToolBarImages m_PanelImages
CMFCRibbonPanel* pPanelClipboard = pCategory->AddPanel(_T("Clipboard"), m_PanelImages.ExtractIcon(1));
pPanelClipboard->SetKeys(_T("zc"));
pPanelClipboard->SetCenterColumnVert();
pPanelClipboard->SetJustifyColumns();
pPanelClipboard->EnableLaunchButton(ID_WRITE_CLIPBOARD, 0);
Inheritance Hierarchy
Requirements
Header: afxRibbonPanel.h