CMFCRibbonSlider Class
The CMFCRibbonSlider class implements a slider control that you can add to a ribbon bar or ribbon status bar. The ribbon slider control resembles the zoom sliders that appear in Office 2007 applications.
class CMFCRibbonSlider : public CMFCRibbonBaseElement
Members
Public Constructors
Name |
Description |
---|---|
Constructs and initializes a ribbon slider control. |
Public Methods
Name |
Description |
---|---|
Returns the current position of the slider control. |
|
Returns the maximum value of the slider. |
|
Returns the minimum value of the slider. |
|
Returns the regular size of the ribbon element. (Overrides CMFCRibbonBaseElement::GetRegularSize.) |
|
Returns the size of the zoom increment for the slider control. |
|
Specifies whether the slider has zoom buttons. |
|
Called by the framework to draw the ribbon element. (Overrides CMFCRibbonBaseElement::OnDraw.) |
|
Sets the current position of the slider control. |
|
Specifies the range of the slider control by setting the minimum and maximum values. |
|
Shows or hides the zoom buttons. |
|
Sets size of the zoom increment for the slider control. |
Remarks
You can use the SetRange method to configure the range of zoom increments for the slider. You can set current position of the slider by using the SetPos method.
You can display circular zoom buttons on the left and right side of the slider control by using the SetZoomButtons method. By default, the slider is horizontal, the left zoom button displays a minus sign and the right zoom button displays a plus sign.
The SetZoomIncrement method defines the increment to add to or subtract from the current position when a user clicks the zoom buttons.
Example
The following example demonstrates how to use various methods in the CMFCRibbonSlider class to set the properties of the slider. The example shows how to construct a CMFCRibbonSlider object, display zoom buttons, set the current position of the slider control, and set the range of values for the slider control.
// Create a ribbon slider.
CMFCRibbonSlider* ribbonSlider = new CMFCRibbonSlider();
// Set the various properties of the slider.
ribbonSlider->SetZoomButtons(true);
ribbonSlider->SetPos(50, TRUE);
ribbonSlider->SetRange(0, 100);
// Add the ribbon slider to the Favorites panel.
// CMFCRibbonPanel* pPanelFavorites
pPanelFavorites->Add(ribbonSlider);
Inheritance Hierarchy
Requirements
Header: afxribbonslider.h