description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CMFCRibbonStatusBar Class |
CMFCRibbonStatusBar Class |
11/04/2016 |
|
|
921eb57f-3b40-49fa-a38c-3f2fb6dc2893 |
The CMFCRibbonStatusBar
class implements a status bar control that can display ribbon elements.
class CMFCRibbonStatusBar : public CMFCRibbonBar
Name | Description |
---|---|
CMFCRibbonStatusBar::AddDynamicElement | Adds a dynamic element to the ribbon status bar. |
CMFCRibbonStatusBar::AddElement | Adds a new ribbon element to the ribbon status bar. |
CMFCRibbonStatusBar::AddExtendedElement | Adds a ribbon element to the extended area of the ribbon status bar. |
CMFCRibbonStatusBar::AddSeparator | Adds a separator to the ribbon status bar. |
CMFCRibbonStatusBar::Create | Creates a ribbon status bar. |
CMFCRibbonStatusBar::CreateEx | Creates a ribbon status bar with an extended style. |
CMFCRibbonStatusBar::FindByID | |
CMFCRibbonStatusBar::FindElement | Returns a pointer to the element that has the specified command ID. |
CMFCRibbonStatusBar::GetCount | Returns the number of elements that are located in the main area of the ribbon status bar. |
CMFCRibbonStatusBar::GetElement | Returns a pointer to the element that is located at a specified index. |
CMFCRibbonStatusBar::GetExCount | Returns the number of elements that are located in the extended area of the ribbon status bar. |
CMFCRibbonStatusBar::GetExElement | Returns a pointer to the element that is located at a specified index in the extended area of the ribbon status bar. |
CMFCRibbonStatusBar::GetExtendedArea | |
CMFCRibbonStatusBar::GetSpace | |
CMFCRibbonStatusBar::IsBottomFrame | |
CMFCRibbonStatusBar::IsExtendedElement | |
CMFCRibbonStatusBar::IsInformationMode | Determines whether information mode is enabled for the ribbon status bar. |
CMFCRibbonStatusBar::RecalcLayout | (Overrides CMFCRibbonBar::RecalcLayout.) |
CMFCRibbonStatusBar::RemoveAll | Removes all elements from the ribbon status bar. |
CMFCRibbonStatusBar::RemoveElement | Removes the element that has a specified command ID from the ribbon status bar. |
CMFCRibbonStatusBar::SetInformation | Enables or disables the information mode for the ribbon status bar. |
Name | Description |
---|---|
CMFCRibbonStatusBar::OnDrawInformation | Displays the information string that appears on the ribbon status bar when the information mode is enabled. |
Users can change the visibility of ribbon elements on a ribbon status bar by using the built-in context menu for the ribbon status bar. You can add or remove elements dynamically.
A ribbon status bar has two areas: a main area and an extended area. The extended area is displayed on the right side of the ribbon status bar and appears in a different color than the main area does.
Typically, the main area of the status bar displays status notifications, and the extended area displays view controls. The extended area remains visible as long as possible when the user resizes the ribbon status bar.
The following example demonstrates how to use various methods in the CMFCRibbonStatusBar
class. The example shows how to add a new ribbon element to the ribbon status bar, add a ribbon element to the extended area of the ribbon status bar, add a separator, and enable the regular mode for the ribbon status bar.
[!code-cppNVC_MFC_RibbonApp#15] [!code-cppNVC_MFC_RibbonApp#16]
Header: afxribbonstatusbar.h
Adds a dynamic element to the ribbon status bar.
void AddDynamicElement(CMFCRibbonBaseElement* pElement);
pElement
[in] A pointer to a dynamic element.
Unlike regular elements, dynamic elements are not customizable and the customize menu of the status bar does not display them.
Adds a new ribbon element to the ribbon status bar.
void AddElement(
CMFCRibbonBaseElement* pElement,
LPCTSTR lpszLabel,
BOOL bIsVisible=TRUE);
pElement
[in] A pointer to the added element.
lpszLabel
[in] A text label of the element.
bIsVisible
[in] TRUE if you want to add the element as visible, FALSE if you want to add the element as hidden.
Adds a ribbon element to the extended area of the ribbon status bar.
void AddExtendedElement(
CMFCRibbonBaseElement* pElement,
LPCTSTR lpszLabel,
BOOL bIsVisible=TRUE);
pElement
[in] A pointer to the added element.
lpszLabel
[in] The text label of the element.
bIsVisible
[in] TRUE if you want to add the element as visible, FALSE if you want to add the element as hidden.
The extended area is on the right side of the status bar control.
Adds a separator to the ribbon status bar.
void AddSeparator();
The framework adds a separator after the method CMFCRibbonStatusBar::AddElement. inserts the last element.
Creates a ribbon status bar.
BOOL Create(
CWnd* pParentWnd,
DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_BOTTOM,
UINT nID=AFX_IDW_STATUS_BAR);
pParentWnd
[in] A pointer to the parent window.
dwStyle
[in] A logical OR combination of control styles.
nID
[in] The control ID of the status bar.
TRUE if the status bar is created successfully, FALSE otherwise.
Creates a ribbon status bar that has an extended style.
BOOL CreateEx(
CWnd* pParentWnd,
DWORD dwCtrlStyle=0,
DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_BOTTOM,
UINT nID=AFX_IDW_STATUS_BAR);
pParentWnd
A pointer to the parent window.
dwCtrlStyle
A logical OR combination of additional styles for creating the status bar object.
dwStyle
The control style of the status bar.
nID
The control ID of the status bar.
TRUE if the status bar is created successfully, FALSE otherwise.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
CMFCRibbonBaseElement* FindByID(UINT uiCmdID, BOOL = TRUE);
[in] uiCmdID
[in] BOOL
Returns a pointer to the element that has the specified command ID.
CMFCRibbonBaseElement* FindElement(UINT uiID);
uiID
[in] The ID of the element.
A pointer to the element that has the specified command ID. NULL if there is no such element.
Returns the number of elements that are located in the main area of the ribbon status bar.
int GetCount() const;
The number of elements that are located in the main area of the ribbon status bar.
Returns a pointer to the element that is located at a specified index.
CMFCRibbonBaseElement* GetElement(int nIndex);
nIndex
[in] Specifies a zero-based index of an element that is located in the main area of the status bar control.
A pointer to the element that is located at the specified index. NULL if the index is negative or exceeds the number of elements in the status bar.
Returns the number of elements that are located in the extended area of the ribbon status bar.
int GetExCount() const;
The number of elements that are located in the extended area of the ribbon status bar.
Returns a pointer to the element that is located at a specified index in the extended area of the ribbon status bar. The extended area is on the right side of the status bar control.
CMFCRibbonBaseElement* GetExElement(int nIndex);
nIndex
[in] Specifies the zero-based index of an element that is located in the extended area of the status bar control.
A pointer to the element that is located at a specified index in the extended area of the ribbon status bar. NULL if nIndex is negative or exceeds the number of elements in the extended area of the ribbon status bar.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
virtual BOOL GetExtendedArea(CRect& rect) const;
[in] rect
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
int GetSpace() const;
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
BOOL IsBottomFrame() const;
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
BOOL IsExtendedElement(CMFCRibbonBaseElement* pElement) const;
[in] pElement
Determines whether information mode is enabled for the ribbon status bar.
BOOL IsInformationMode() const;
TRUE if the status bar can work in information mode; otherwise FALSE.
In information mode, the status bar hides all regular panes and displays a message string.
Displays the string that appears on the ribbon status bar when the information mode is enabled.
virtual void OnDrawInformation(
CDC* pDC,
CString& strInfo,
CRect rectInfo);
pDC
[in] A pointer to a device context.
strInfo
[in] The information string.
rectInfo
[in] The bounding rectangle.
Override this method in a derived class if you want to customize the appearance of the information string on the status bar. Use the CMFCRibbonStatusBar::SetInformation method to put the status bar in information mode. In this mode, the status bar hides all panes and displays the information string specified by strInfo.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
virtual void RecalcLayout();
Removes all elements from the ribbon status bar.
void RemoveAll();
Removes the element that has a specified command ID from the ribbon status bar.
BOOL RemoveElement(UINT uiID);
uiID
[in] The ID of the element to remove from the status bar.
TRUE if an element with the specified uiID is removed. FALSE otherwise.
Enables or disables the information mode for the ribbon status bar.
void SetInformation(LPCTSTR lpszInfo);
lpszInfo
[in] The information string.
Use this method to put the status bar in the information mode. In this mode, the status bar hides all panes and displays the information string specified by lpszInfo.
When lpszInfo is NULL, the status bar reverts to regular mode.
Hierarchy Chart
Classes
CMFCRibbonBar Class
CMFCRibbonBaseElement Class
CMFCRibbonBar Class