Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 17: Track-Based Controls Visual C++ and MFC Fundamentals


The thumb of a slider can assume one of three shapes. By default, it appears as a
rectangular box. Alternatively, you can convert one of its shorter borders to appear as an
arrow. The shape of the thumb is controlled at design time by the Point property. Its
default value is Both, which gives it a rectangular shape. You can get this same shape by
omitting or adding the TBS_BOTH value.

For a horizontal slider, you can make the thumb’s arrow point to the left by changing the
Point property to Top/Left. If the slider were horizontal, this Point value would orient
the thumb arrow to the top:

To make the thumb of a dynamically created horizontal slider point up, add the
TBS_TOP. If the slider is vertical, to point its thumb to the left, add the TBS_LEFT
style to it.

If you want the thumb to point down for a horizontal slider, set the Point property to
Bottom/Right. This same value would make the thumb of a vertical slider point n the
right direction:

To point the thumb up for a horizontal slider you are programmatically creating, add the
TBS_BOTTOM. For the thumb of a vertical slider to point right, add the TBS_RIGHT
to it.

If you want to guide the user with some ticks on the control, at design time, set the Tick
Marks property to True. If you are dynamically creating the slider and you want it to
display ticks, simply adding the either the TBS_VERT or the TBS_HORZ style equips
Free download pdf