CMFCRibbonProgressBar Class
Implements a control that visually indicates the progress of a lengthy operation.
class CMFCRibbonProgressBar : public CMFCRibbonBaseElement
Name | Description |
---|---|
CMFCRibbonProgressBar::CMFCRibbonProgressBar | Constructs and initializes a CMFCRibbonProgressBar object. |
Name | Description |
---|---|
CMFCRibbonProgressBar::GetPos | Returns the current progress. |
CMFCRibbonProgressBar::GetRangeMax | Returns the maximum value of the current range. |
CMFCRibbonProgressBar::GetRangeMin | Returns the minimum value of the current range. |
CMFCRibbonProgressBar::GetRegularSize | Returns the regular size of the ribbon element. (Overrides CMFCRibbonBaseElement::GetRegularSize.) |
CMFCRibbonProgressBar::IsInfiniteMode | Specifies whether the progress bar is working in infinite mode. |
CMFCRibbonProgressBar::OnDraw | Called by the framework to draw the ribbon element. (Overrides CMFCRibbonBaseElement::OnDraw.) |
CMFCRibbonProgressBar::SetInfiniteMode | Sets the progress bar to work in infinite mode. |
CMFCRibbonProgressBar::SetPos | Sets the current progress. |
CMFCRibbonProgressBar::SetRange | Sets the minimum and maximum values. |
A CMFCRibbonProgressBar
can operate in two modes: regular and infinite. In regular mode, the progress bar is filled from left to right and stops when it reaches the maximum value. In infinite mode, the progress bar is repeatedly filled from the minimum value to the maximum value. You might use infinite mode to indicate that an operation is ongoing, but that the completion time is unknown.
The following example demonstrates how to use various methods in the CMFCRibbonProgressBar
class. The example shows how to set the progress bar to work in infinite mode (where the completion time of an operation is unknown), set the minimum and maximum values for the progress bar, and set the current position of the progress bar. This code snippet is part of the MS Office 2007 Demo sample.
// int cxProgress
// BOOL m_bInfiniteProgressMode
CMFCRibbonProgressBar *pProgressBar = new CMFCRibbonProgressBar(ID_STATUSBAR_PROGRESS, cxProgress);
pProgressBar->SetInfiniteMode(m_bInfiniteProgressMode);
pProgressBar->SetRange(0, 200);
pProgressBar->SetPos(200, true);
Header: afxRibbonProgressBar.h
Constructs and initializes a CMFCRibbonProgressBar object.
CMFCRibbonProgressBar();
CMFCRibbonProgressBar(
UINT nID,
int nWidth = 90,
int nHeight = 22);
nID
[in] Specifies the command ID for the ribbon progress bar.
nWidth
[in] Specifies the width, in pixels, of the ribbon progress bar.
nHeight
[in] Specifies the height, in pixels, of the ribbon progress bar.
Returns the current position of the progress bar.
int GetPos () const;
A value representing the current position of the progress bar.
The range being set must be within the range specified by the CMFCRibbonProgressBar::SetRange method.
Returns the progress bar's current maximum value.
int GetRangeMax() const;
The maximum value of the current range.
Returns the progress bar's current minimum range value.
int GetRangeMin() const;
The minimum value of the current range.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
virtual CSize GetRegularSize(CDC* pDC);
[in] pDC
Specifies whether the progress bar is working in infinite mode.
BOOL IsInfiniteMode() const;
TRUE if the progress bar is in infinite mode; otherwise, FALSE.
In infinite mode, the progress bar fills repeatedly from the minimum value to the maximum value. You might use infinite mode to indicate that an operation is ongoing, but that the completion time is unknown.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
virtual void OnDraw(CDC* pDC);
[in] pDC
Sets the progress bar to work in infinite mode.
void SetInfiniteMode(BOOL bSet = TRUE);
bSet
[in] TRUE to specify that the progress bar is in infinite mode; otherwise, FALSE.
Usually, if the progress bar is in infinite mode, it is telling the user that an operation is ongoing, but that the completion time is unknown. Thus, the progress bar fills repeatedly from the minimum value to the maximum value.
Sets the current position of the progress bar.
void SetPos(
int nPos,
BOOL bRedraw = TRUE);
nPos
[in] Specifies the position to which the progress bar is set.
bRedraw
[in] Specifies whether the progress bar should be redrawn.
The range being set must be within the range specified by the CMFCRibbonProgressBar::SetRange method.
Sets the minimum and maximum values for the progress bar.
void SetRange(
int nMin,
int nMax);
nMin
[in] Specifies the minimum value of the range.
nMax
[in] Specifies the maximum value of the range.
Use this method to define the range of the progress bar by setting minimum and maximum values.
Hierarchy Chart
Classes
CMFCRibbonBaseElement Class
CMFCRibbonBar Class