共用方式為


CMFCRibbonBar Class

The CMFCRibbonBar class implements a ribbon bar similar to that used in Office 2007.

class CMFCRibbonBar : public CPane

Members

Public Constructors

Name

Description

CMFCRibbonBar::CMFCRibbonBar

Default constructor.

Public Methods

Name

Description

CMFCRibbonBar::ActivateContextCategory

Activates a context category that is already visible.

CMFCRibbonBar::AddCategory

Adds a new ribbon category to the ribbon.

CMFCRibbonBar::AddContextCategory

Adds a context category.

CMFCRibbonBar::AddMainCategory

Adds a new main ribbon category.

CMFCRibbonBar::AddPrintPreviewCategory

 

CMFCRibbonBar::AddQATOnlyCategory

 

CMFCRibbonBar::AddToTabs

Add a ribbon element to the right side of a ribbon bar.

CMFCRibbonBar::CreateEx

Creates a control bar and attaches it to the CPane object. (Overrides CPane::CreateEx.)

CMFCRibbonBar::Create

Creates a ribbon bar control and attaches it to a ribbon bar.

CMFCRibbonBar::DeactivateKeyboardFocus

 

CMFCRibbonBar::DrawMenuImage

 

CMFCRibbonBar::DWMCompositionChanged

 

CMFCRibbonBar::EnableKeyTips

Enable or disable key tips for the ribbon control.

CMFCRibbonBar::EnablePrintPreview

Enable the Print Preview tab.

CMFCRibbonBar::EnableToolTips

Enables or disables tooltips and tooltip descriptions on the ribbon bar.

CMFCRibbonBar::FindByData

Find a ribbon element by using data that a user specifies.

CMFCRibbonBar::FindByID

Finds a ribbon element that has the specified command id.

CMFCRibbonBar::FindCategoryIndexByData

Finds the index of the ribbon category that contains the user-defined data.

CMFCRibbonBar::ForceRecalcLayout

 

CMFCRibbonBar::GetActiveCategory

Gets a pointer to an active category.

CMFCRibbonBar::GetCaptionHeight

Returns the caption height. (Overrides CBasePane::GetCaptionHeight.)

CMFCRibbonBar::GetCategory

Gets the pointer to a category located at a specified index.

CMFCRibbonBar::GetCategoryCount

Gets the number of the ribbon categories in the ribbon bar.

CMFCRibbonBar::GetCategoryHeight

 

CMFCRibbonBar::GetCategoryIndex

Returns the index of a ribbon category.

CMFCRibbonBar::GetContextName

Retrieves the name of the context category caption that you specify by using an ID.

CMFCRibbonBar::GetDroppedDown

 

CMFCRibbonBar::GetElementsByID

Gets an array that contains the pointers to all the ribbon elements that have the specified ID.

CMFCRibbonBar::GetApplicationButton

Gets a pointer to a ribbon button.

CMFCRibbonBar::GetFocused

Returns a focused element.

CMFCRibbonBar::GetHideFlags

 

CMFCRibbonBar::GetItemIDsList

 

CMFCRibbonBar::GetKeyboardNavigationLevel

 

CMFCRibbonBar::GetKeyboardNavLevelCurrent

 

CMFCRibbonBar::GetKeyboardNavLevelParent

 

CMFCRibbonBar::GetMainCategory

Returns a pointer to the ribbon category that is currently selected.

CMFCRibbonBar::GetQATCommandsLocation

 

CMFCRibbonBar::GetQATDroppedDown

 

CMFCRibbonBar::GetQuickAccessCommands

Fills a list that contains the command IDs of all the elements that appear on the Quick Access Toolbar.

CMFCRibbonBar::GetQuickAccessToolbarLocation

 

CMFCRibbonBar::GetTabTrancateRatio

 

CMFCRibbonBar::GetTooltipFixedWidthLargeImage

 

CMFCRibbonBar::GetTooltipFixedWidthRegular

 

CMFCRibbonBar::GetVisibleCategoryCount

 

CMFCRibbonBar::HideAllContextCategories

Hides all the categories that are active and visible.

CMFCRibbonBar::HideKeyTips

 

CMFCRibbonBar::HitTest

Finds a pointer to the ribbon element that is located at the specified point in the ribbon bar's client coordinates.

CMFCRibbonBar::IsKeyTipEnabled

Determines whether keytips are enabled.

CMFCRibbonBar::IsMainRibbonBar

 

CMFCRibbonBar::IsPrintPreviewEnabled

Determines whether the Print Preview tab is enabled.

CMFCRibbonBar::IsQATEmpty

 

CMFCRibbonBar::IsQuickAccessToolbarOnTop

Specifies whether the Quick Access Toolbar is located above the ribbon bar.

CMFCRibbonBar::IsReplaceFrameCaption

Determines whether the ribbon bar replaces the main frame caption, or is added below the frame caption.

CMFCRibbonBar::IsShowGroupBorder

 

CMFCRibbonBar::IsToolTipDescrEnabled

Determines whether the tooltip descriptions are enabled.

CMFCRibbonBar::IsToolTipEnabled

Determines whether the tooltips for the ribbon bar are enabled.

CMFCRibbonBar::IsTransparentCaption

 

CMFCRibbonBar::IsWindows7Look

Indicates whether the ribbon has Windows 7-style look (small rectangular application button).

CMFCRibbonBar::LoadFromResource

Overloaded. Loads a Ribbon Bar from application resources.

CMFCRibbonBar::OnClickButton

 

CMFCRibbonBar::OnEditContextMenu

 

CMFCRibbonBar::OnRTLChanged

  (Overrides CPane::OnRTLChanged.)

CMFCRibbonBar::OnSetAccData

  (Overrides CBasePane::OnSetAccData.)

CMFCRibbonBar::OnShowRibbonContextMenu

 

CMFCRibbonBar::OnShowRibbonQATMenu

 

CMFCRibbonBar::OnSysKeyDown

 

CMFCRibbonBar::OnSysKeyUp

 

CMFCRibbonBar::PopTooltip

 

CMFCRibbonBar::PreTranslateMessage

  (Overrides CBasePane::PreTranslateMessage.)

CMFCRibbonBar::RecalcLayout

  (Overrides CPane::RecalcLayout.)

CMFCRibbonBar::RemoveAllCategories

Removes all the ribbon categories from the ribbon bar.

CMFCRibbonBar::RemoveAllFromTabs

Removes all ribbon elements from the tab area.

CMFCRibbonBar::RemoveCategory

Removes the ribbon category that is located at the specified index.

CMFCRibbonBar::SaveToXMLBuffer

Saves the Ribbon Bar to a buffer.

CMFCRibbonBar::SaveToXMLFile

Saves the Ribbon Bar to XML file.

CMFCRibbonBar::SetActiveCategory

Sets a specified ribbon category to active.

CMFCRibbonBar::SetActiveMDIChild

 

CMFCRibbonBar::SetElementKeys

Sets the specified keytips for all ribbon elements that have the specified command ID.

CMFCRibbonBar::SetApplicationButton

Assigns an application ribbon button to the ribbon bar.

CMFCRibbonBar::SetKeyboardNavigationLevel

 

CMFCRibbonBar::SetMaximizeMode

 

CMFCRibbonBar::SetQuickAccessCommands

Adds one or more ribbon elements to the Quick Access Toolbar.

CMFCRibbonBar::SetQuickAccessDefaultState

Specifies the default state for the Quick Access Toolbar.

CMFCRibbonBar::SetQuickAccessToolbarOnTop

Positions the Quick Access Toolbar (QAT) above or below the ribbon bar.

CMFCRibbonBar::SetTooltipFixedWidth

 

CMFCRibbonBar::SetWindows7Look

Enable/disable ribbon Windows 7-style look (small rectangular application button)

CMFCRibbonBar::ShowCategory

Shows or hides the specified ribbon category.

CMFCRibbonBar::ShowContextCategories

Shows or hides the context categories that have the specified ID.

CMFCRibbonBar::ShowKeyTips

 

CMFCRibbonBar::ToggleMimimizeState

Toggles the ribbon bar between the minimized and maximized states..

CMFCRibbonBar::TranslateChar

 

Remarks

Microsoft introduced the Office Fluent Ribbon when it simultaneously released Microsoft Office 2007. This ribbon bar is not just a new control. It represents a new user-interface paradigm. The ribbon is a pane that contains a set of tabs called categories. Each category is logically split into ribbon panels and each panel can contain various controls and command buttons.

The elements that appear on the ribbon bar expand and contract to make the best use of available space. For example, if a ribbon panel has insufficient space to display its elements, it becomes a menu button that displays subitems on a pop-up menu. The ribbon bar behaves as a static (non-floating) control bar and can be docked at the top of a frame.

You can use the CMFCRibbonStatusBar class to implement a status bar similar to the one used in Office 2007. A ribbon category contains (and displays) a group of ribbon panels. Each ribbon panel contains one or more ribbon elements, which are derived from CMFCRibbonBaseElement.

For information about how to add a ribbon bar to your existing MFC application, see Walkthrough: Updating the MFC Scribble Application.

Inheritance Hierarchy

CObject

   CCmdTarget

      CWnd

         CBasePane

            CPane

               CMFCRibbonBar

Requirements

Header: afxribbonbar.h

See Also

Tasks

Walkthrough: Updating the MFC Scribble Application

Reference

Hierarchy Chart

CPane Class

CMFCRibbonCategory Class

CMFCRibbonPanel Class

CMFCRibbonBaseElement Class

Other Resources

MFC Classes