The TrackBar control allows the user to drag a pointer along a bar to select a numeric value. This control is very similar to a horizontal scroll bar, but with a different appearance.
The following table describes the control’s most useful properties.
Property | Purpose |
---|---|
AutoSize | Determines whether the control automatically sets its height or width, depending on its Orientation property. For example, if the control’s orientation is horizontal, then setting AutoSize to True makes the control pick a height that is appropriate for the control’s width. |
LargeChange | The amount by which the control’s value changes when the user clicks on the TrackBar, but not on its pointer. |
Maximum | The largest value that the user can select. |
Minimum | The smallest value that the user can select. |
Orientation | Determines the control’s orientation. This can be Horizontal or Vertical. |
SmallChange | The amount by which the control’s value changes when the user presses an arrow key. |
TickFrequency | The number of values between tick marks on the control. |
TickStyle | Determines the position of tick marks on the control. This can be TopLeft (on the top if Orientation is Horizontal; on the left if Orientation is Vertical), BottomRight (on the bottom if Orientation is Horizontal; on the right if Orientation is Vertical), Both, or None. |
Value | The control’s current numeric value. |
The control’s Value, Minimum, Maximum, and TickFrequency properties are integer values, so the TrackBar control is not ideal for letting the user select a nonintegral value such as 1.25.
The control’s Scroll event fires when the user changes the control’s value interactively. The ValueChanged event occurs when the control’s value changes either because the user changed it interactively or because the program changed it with code.