CMFCRibbonStatusBarPane Class
The CMFCRibbonStatusBarPane
class implements a ribbon element that you can add to a ribbon status bar.
class CMFCRibbonStatusBarPane : public CMFCRibbonButton
Name | Description |
---|---|
CMFCRibbonStatusBarPane::CMFCRibbonStatusBarPane | Constructs and initializes a CMFCRibbonStatusBarPane object. |
Name | Description |
---|---|
CMFCRibbonStatusBarPane::GetAlmostLargeText | Returns the string that defines the longest text string that can be displayed in the pane without truncation. |
CMFCRibbonStatusBarPane::GetTextAlign | Returns the current setting of the text alignment. |
CMFCRibbonStatusBarPane::IsAnimation | Determines whether the animation is in progress. |
CMFCRibbonStatusBarPane::IsExtended | Determines whether the pane is located in the extended area of the ribbon status bar. |
CMFCRibbonStatusBarPane::OnDrawBorder | (Overrides CMFCRibbonButton::OnDrawBorder.) |
CMFCRibbonStatusBarPane::OnFillBackground | (Overrides CMFCRibbonButton::OnFillBackground.) |
CMFCRibbonStatusBarPane::SetAlmostLargeText | Defines the longest text string that can be displayed in the pane without truncation. |
CMFCRibbonStatusBarPane::SetAnimationList | Assigns to the pane an image list that can be used for animation. |
CMFCRibbonStatusBarPane::SetTextAlign | Sets the text alignment. |
CMFCRibbonStatusBarPane::StartAnimation | Starts the animation that is assigned to the pane. |
CMFCRibbonStatusBarPane::StopAnimation | Stops the animation that is assigned to the pane. . |
Name | Description |
---|---|
CMFCRibbonStatusBarPane::OnFinishAnimation | Called by the framework when the animation that is assigned to the pane stops. |
The following example demonstrates how to use the various methods in the CMFCRibbonStatusBarPane
class. The example shows how to construct a CMFCRibbonStatusBarPane
object, set the text alignment of the label of the status bar pane, define the longest text that can be displayed in the status bar pane without truncation, attach to the status bar pane an image list that can be used for animation, and start the animation.
CString strTitlePane1;
CString strTitlePane2;
strTitlePane1.LoadString(IDS_STATUS_PANE1);
strTitlePane2.LoadString(IDS_STATUS_PANE2);
CMFCRibbonStatusBarPane* rsbp = new CMFCRibbonStatusBarPane( ID_STATUSBAR_PANE1, strTitlePane1, TRUE );
rsbp->SetTextAlign( TA_CENTER );
rsbp->SetAlmostLargeText( _T( "Status bar" ) );
CBitmap bitmap;
bitmap.LoadBitmapW( IDB_FILESMALL );
rsbp->SetAnimationList( (HBITMAP)bitmap );
rsbp->StartAnimation();
Header: afxribbonstatusbarpane.h
Construct a pane object in the status bar.
CMFCRibbonStatusBarPane(
UINT nCmdID,
LPCTSTR lpszText,
BOOL bIsStatic=FALSE,
HICON hIcon=NULL,
LPCTSTR lpszAlmostLargeText=NULL);
CMFCRibbonStatusBarPane(
UINT nCmdID,
LPCTSTR lpszText,
HBITMAP hBmpAnimationList,
int cxAnimation=16,
COLORREF clrTrnsp=RGB(192,192 1,192) 1,
HICON hIcon=NULL,
BOOL bIsStatic=FALSE);
CMFCRibbonStatusBarPane(
UINT nCmdID,
LPCTSTR lpszText,
UINT uiAnimationListResID,
int cxAnimation=16,
COLORREF clrTrnsp=RGB(192, 192 1, 192) 1,
HICON hIcon=NULL,
BOOL bIsStatic=FALSE);
nCmdID
[in] Specifies the command ID of the pane.
lpszText
[in] Specifies text string to be displayed on pane.
bIsStatic
[in] If TRUE, the status pane cannot be highlighted or selected by clicking it.
hIcon
[in] Specifies a handle to an icon to be displayed on the pane.
lpszAlmostLargeText
[in] Specifies the longest text string that can be displayed by the pane.
hBmpAnimationList
[in] Specifies a handle to an image list that is used for animation.
cxAnimation
[in] Specifies the width, in pixels, of the icon in the image list that is used for animation.
clrTrnsp
[in] Specifies the transparent color of images in the image list that are used for animation.
uiAnimationListResID
[in] Specifies a resource ID of an image list that is used for animation.
Gets the longest text string that the status bar pane can display.
LPCTSTR GetAlmostLargeText() const;
The longest text string that the status bar pane can display.
Gets the current setting of the text alignment of the label of the status bar pane.
int GetTextAlign() const;
The current text alignment which can be one of the following:
TA_LEFT
TA_CENTER
TA_RIGHT.
Determines whether the animation is in progress.
BOOL IsAnimation() const;
TRUE if animation is in progress; FALSE otherwise.
Determine whether the pane is located in the extended area of the ribbon status bar.
BOOL IsExtended() const;
TRUE if pane is on status bar extended area. FALSE otherwise.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
virtual void OnDrawBorder(CDC*);
[in] CDC*
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
virtual COLORREF OnFillBackground(CDC* pDC);
[in] pDC
Framework calls this method when the animation that is assigned to the pane ends.
virtual void OnFinishAnimation();
StopAnimation
method calls the OnFinishAnimation
method, which you can use to clean up data when the animation ends.
Define the longest text that can be displayed in the status bar pane without truncation.
void SetAlmostLargeText(LPCTSTR lpszAlmostLargeText);
lpszAlmostLargeText
[in] Specifies the longest string that can be displayed on the status bar pane without truncation.
The library calculates the size of text that lpszAlmostLargeText specifies and resizes the pane accordingly. The text will be truncated if it still does not fit in the pane.
Attaches to the status bar pane an image list that can be used for animation.
void SetAnimationList(
HBITMAP hBmpAnimationList,
int cxAnimation=16,
COLORREF clrTransp=RGB(192, 192 1, 192) 1);
BOOL SetAnimationList(
UINT uiAnimationListResID,
int cxAnimation=16,
COLORREF clrTransp=RGB(192, 192 1, 192) 1);
hBmpAnimationList
[in] Specifies a handle to an image list.
cxAnimation
[in] Specifies the width, in pixels, of the frame in the image list.
clrTransp
[in] Specifies the transparent color of the image list.
uiAnimationListResID
[in] Specifies the resource ID of the image list.
TRUE if the image list is successfully attached to the status bar pane; FALSE otherwise.
Sets the text alignment of the label of the status bar pane.
void SetTextAlign(int nAlign);
nAlign
[in] Specifies the text alignment.
nAlign can have one of the following values:
TA_LEFT: left alignment
TA_CENTER: center alignment
TA_RIGHT: right alignment
Starts the animation that you assign to the pane.
void StartAnimation(
UINT nFrameDelay=500,
UINT nDuration=-1);
nFrameDelay
[in] Specifies the animation frame rate, in milliseconds.
nDuration
[in] Specifies how long to play the animation, in milliseconds. Use -1 for an infinite loop.
You must specify a handle to an image list before you call StartAnimation
by using SetAnimationList
.
Stops the animation that you assigned to the status bar pane.
void StopAnimation();
Hierarchy Chart
Classes
CMFCRibbonButton Class
CMFCRibbonStatusBar Class