Partager via


CProgressCtrl::SetPos

Sets the progress bar control's current position as specified by nPos and redraws the bar to reflect the new position.

int SetPos(
   int nPos 
);

Parameters

  • nPos
    New position of the progress bar control.

Return Value

The previous position of the progress bar control.

Remarks

The position of the progress bar control is not the physical location on the screen, but rather is between the upper and lower range indicated in SetRange.

Example

CProgressCtrl myCtrl;

// Create a child progress control.
myCtrl.Create(WS_CHILD|WS_VISIBLE, CRect(10,10,200,30), pParentWnd, 
   IDC_PROGRESSCTRL);

// Set the range to be 0 to 100.
myCtrl.SetRange(0, 100);

// Set the position to be half, 50.
myCtrl.SetPos(50);   

Requirements

Header: afxcmn.h

See Also

Concepts

CProgressCtrl Class

CProgressCtrl Members

Hierarchy Chart

CProgressCtrl::OffsetPos

CProgressCtrl::SetRange

CProgressCtrl::StepIt