JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the TrackBar Class

As discussed in the In Depth section of this chapter, track bars work much like scroll bars, but they have a different appearance, resembling the controls you'd find on a stereo. Like scroll bars, the Value property holds the track bar's current setting, and you can handle the Scroll and ValueChanged events to work with this control. Track bars also can display ticks, giving the user an idea of the scale used to set the control's value. Here is the class hierarchy for the TrackBar class:

Object
   MarshalByRefObject
      Component
         Control
            TrackBar

You can find the more notable public properties of the TrackBar class in Table 8.8, the more notable methods in Table 8.9, and the more notable events in Table 8.10. Note that as with other Windows controls, I am not listing the notable properties, methods, and events TrackBar inherits from the Control class, such as the Click event—you can see all that in Tables 5.1, 5.2, and 5.3 in Chapter 5.

Table 8.8: Noteworthy public properties of TrackBar objects.

Property

Means

AutoSize

Gets/sets if the track bar's height or width should be automatically sized.

ForeColor

Holds the foreground color of the track bar.

LargeChange

Gets/sets the value added to or subtracted from to the Value property when the scroll box moves a large distance.

Maximum

Holds the upper limit of the range of this track bar.

Minimum

Holds the lower limit of the range of this track bar.

Orientation

Gets/sets the horizontal or vertical orientation of the track bar.

SmallChange

Gets/sets a value which is added to or subtracted from the Value property when the scroll box moves a small distance.

TickFrequency

Gets/sets a value specifying the distance between ticks.

TickStyle

Gets/sets how to display the tick marks in the track bar.

Value

Gets/sets the current position of the slider in the track bar.

Table 8.9: Noteworthy public methods of TrackBar objects.

Method

Means

SetRange

Sets the Minimum and Maximum values for the track bar.

Table 8.10: Noteworthy public events of TrackBar objects.

Event

Means

Scroll

Occurs when the slider moves (either by mouse or keyboard action).

ValueChanged

Occurs when the Value property of a track bar changes (either by moving the slider or through code).

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor