Edit

Share via


CMFCRibbonProgressBar Class

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

Syntax

class CMFCRibbonProgressBar : public CMFCRibbonBaseElement

Members

Public Constructors

Name Description
CMFCRibbonProgressBar::CMFCRibbonProgressBar Constructs and initializes a CMFCRibbonProgressBar object.

Public Methods

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.

Remarks

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.

Example

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

Inheritance Hierarchy

CObject

CMFCRibbonBaseElement

CMFCRibbonProgressBar

Requirements

Header: afxRibbonProgressBar.h

CMFCRibbonProgressBar::CMFCRibbonProgressBar

Constructs and initializes a CMFCRibbonProgressBar object.

CMFCRibbonProgressBar();

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

Parameters

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.

CMFCRibbonProgressBar::GetPos

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.

CMFCRibbonProgressBar::GetRangeMax

Returns the progress bar's current maximum value.

int GetRangeMax() const;

Return Value

The maximum value of the current range.

Remarks

CMFCRibbonProgressBar::GetRangeMin

Returns the progress bar's current minimum range value.

int GetRangeMin() const;

Return Value

The minimum value of the current range.

CMFCRibbonProgressBar::GetRegularSize

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

CMFCRibbonProgressBar::IsInfiniteMode

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.

CMFCRibbonProgressBar::OnDraw

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

CMFCRibbonProgressBar::SetInfiniteMode

Sets the progress bar to work in infinite mode.

void SetInfiniteMode(BOOL bSet = TRUE);

Parameters

bSet
[in] 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.

CMFCRibbonProgressBar::SetPos

Sets the current position of the progress bar.

void SetPos(
    int nPos,
    BOOL bRedraw = TRUE);

Parameters

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

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

Remarks

The range being set must be within the range specified by the CMFCRibbonProgressBar::SetRange method.

CMFCRibbonProgressBar::SetRange

Sets the minimum and maximum values for the progress bar.

void SetRange(
    int nMin,
    int nMax);

Parameters

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

nMax
[in] 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.

See also

Hierarchy Chart
Classes
CMFCRibbonBaseElement Class
CMFCRibbonBar Class