Condividi tramite


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

CMFCRibbonSlider::CMFCRibbonSlider

Constructs and initializes a ribbon slider control.

Public Methods

Name

Description

CMFCRibbonSlider::GetPos

Returns the current position of the slider control.

CMFCRibbonSlider::GetRangeMax

Returns the maximum value of the slider.

CMFCRibbonSlider::GetRangeMin

Returns the minimum value of the slider.

CMFCRibbonSlider::GetRegularSize

Returns the regular size of the ribbon element. (Overrides CMFCRibbonBaseElement::GetRegularSize.)

CMFCRibbonSlider::GetZoomIncrement

Returns the size of the zoom increment for the slider control.

CMFCRibbonSlider::HasZoomButtons

Specifies whether the slider has zoom buttons.

CMFCRibbonSlider::OnDraw

Called by the framework to draw the ribbon element. (Overrides CMFCRibbonBaseElement::OnDraw.)

CMFCRibbonSlider::SetPos

Sets the current position of the slider control.

CMFCRibbonSlider::SetRange

Specifies the range of the slider control by setting the minimum and maximum values.

CMFCRibbonSlider::SetZoomButtons

Shows or hides the zoom buttons.

CMFCRibbonSlider::SetZoomIncrement

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

CObject

   CMFCRibbonBaseElement

      CMFCRibbonSlider

Requirements

Header: afxribbonslider.h

See Also

Reference

Hierarchy Chart

CMFCRibbonBaseElement Class

Other Resources

MFC Classes