CMFCRibbonProgressBar Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCRibbonProgressBar Class.

Implements a control that visually indicates the progress of a lengthy operation.

class CMFCRibbonProgressBar : public CMFCRibbonBaseElement  

Public Constructors

NameDescription
CMFCRibbonProgressBar::CMFCRibbonProgressBarConstructs and initializes a CMFCRibbonProgressBar object.

Public Methods

NameDescription
CMFCRibbonProgressBar::GetPosReturns the current progress.
CMFCRibbonProgressBar::GetRangeMaxReturns the maximum value of the current range.
CMFCRibbonProgressBar::GetRangeMinReturns the minimum value of the current range.
CMFCRibbonProgressBar::GetRegularSizeReturns the regular size of the ribbon element. (Overrides CMFCRibbonBaseElement::GetRegularSize.)
CMFCRibbonProgressBar::IsInfiniteModeSpecifies whether the progress bar is working in infinite mode.
CMFCRibbonProgressBar::OnDrawCalled by the framework to draw the ribbon element. (Overrides CMFCRibbonBaseElement::OnDraw.)
CMFCRibbonProgressBar::SetInfiniteModeSets the progress bar to work in infinite mode.
CMFCRibbonProgressBar::SetPosSets the current progress.
CMFCRibbonProgressBar::SetRangeSets 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);

CObject

CMFCRibbonBaseElement

CMFCRibbonProgressBar

Header: afxRibbonProgressBar.h

Constructs and initializes a CMFCRibbonProgressBar object.

CMFCRibbonProgressBar();

 
CMFCRibbonProgressBar(
    UINT nID,  
    int nWidth = 90,  
    int nHeight = 22);

Parameters

[in] nID
Specifies the command ID for the ribbon progress bar.

[in] nWidth
Specifies the width, in pixels, of the ribbon progress bar.

[in] nHeight
Specifies the height, in pixels, of the ribbon progress bar.

Returns the current position of the progress bar.

int GetPos () const;  

Return Value

A value representing the current position of the progress bar.

Remarks

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;  

Return Value

The maximum value of the current range.

Remarks

Returns the progress bar's current minimum range value.

int GetRangeMin() const;  

Return Value

The minimum value of the current range.

This topic is included for completeness. 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);

Parameters

[in] pDC

Return Value

Remarks

Specifies whether the progress bar is working in infinite mode.

BOOL IsInfiniteMode() const;  

Return Value

TRUE if the progress bar is in infinite mode; otherwise, FALSE.

Remarks

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.

This topic is included for completeness. 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);

Parameters

[in] pDC

Remarks

Sets the progress bar to work in infinite mode.

void SetInfiniteMode(BOOL bSet = TRUE);

Parameters

[in] bSet
TRUE to specify that the progress bar is in infinite mode; otherwise, FALSE.

Remarks

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);

Parameters

[in] nPos
Specifies the position to which the progress bar is set.

[in] bRedraw
Specifies whether the progress bar should be redrawn.

Remarks

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);

Parameters

[in] nMin
Specifies the minimum value of the range.

[in] nMax
Specifies the maximum value of the range.

Remarks

Use this method to define the range of the progress bar by setting minimum and maximum values.

Hierarchy Chart
Classes
CMFCRibbonBaseElement Class
CMFCRibbonBar Class

Show: