Scrollbar Control

This control provides easy navigation through a long list of items or a large amount of information by enabling a user to scroll either horizontally or vertically within an application or control. A Scrollbar control also provides an analog representation of the current position.

Syntax

HScrollBar

VScrollBar

The Scrollbar control supports the following properties:

Container Parent
Enabled SmallChange
Height TabIndex
HWnd TabStop
LargeChange Tag
Left Top
Max Value
Min Visible
Name Width

The Scrollbar control supports the following methods:

The Scrollbar control supports the following events:

Remarks

You can use a scroll bar as an input device or as an indicator of speed or quantity—for example, to control the volume of a computer game or to view the time elapsed in a timed process.

Scroll bar controls use the Scroll and Change events to monitor the movement of a scroll box, sometimes referred to as the thumb, along a scroll bar. Using the Scroll event provides access to the scroll bar value as it is dragged. The Change event occurs after a user releases the scroll box or selects the scroll bar or scroll arrows.

The Value property (default is 0) is an integer value that corresponds to the position of the scroll box in the scroll bar. When the scroll box position is at the minimum value, it moves to the leftmost position (for horizontal scroll bars) or the uppermost position (for vertical scroll bars). When the scroll box is at the maximum value, the scroll box moves to the rightmost or bottom position. Similarly, a value halfway between the bottom and top of the range places the scroll box in the middle of the scroll bar.

To use a scroll bar as an indicator of quantity or speed or as an input device, use the Max and Min properties to set the appropriate range for the control. Min can be larger than Max if you want your scroll bar to display information descending order.

To specify the amount of change to report in a scroll bar, use the LargeChange property for choosing the area within the scroll bar and the SmallChange property for choosing the arrows at the ends of the scroll bar. The scroll bar's Value property increases or decreases by the values set for the LargeChange and SmallChange properties. You can position the scroll box at run time by setting Value from 0 through 32,767.