The slider control (Slider control) is also called the track strip, which uses a small window with tracks and sliders and a scale on the window to allow the user to select a discrete data or a continuous range of values. Selection of data through the mouse or keyboard, which can be seen in many applications in win98/95, such as the mouse in the Control Panel, the slider can be either horizontal or vertical. The sliding bar controls the following style:
The Tbs_horz slider is horizontally oriented.
The Tbs_vert slider is vertically oriented.
Tbs_left slider is on the left side of the window
Tbs_right Slider is on the right side of the window
Tbs_top slider at top of window
Tbs_bottom slider at the bottom of the window
Tbs_both Slider is positioned on both sides of the window
The Tbs_autoticks slider has a scale, and the default
Tbs_noticks Slider does not have a scale
The tick bars of the slider display a tick mark in each numeric position, and if a value selection interval is displayed on the slider, the style tbs_enableselrange should be used, at which point the selection interval two is no longer a tick mark, but a small triangular symbol. In addition, the use of style tbs_nothumb will make the slider fade.
The slider control is encapsulated in the MFC class Library as CSliderCtrl control, whose main operation is to set scale range, draw tick marks, set selection range and current slide position. When the user interacts, the slider control sends message wm_hscroll to its parent window, so the OnHScroll () member function of the parent window should be overloaded in the application so that the message is properly handled by the system's notification code, The position of the slider and the pointer to the CSliderCtrl object. Since the pointer variable in the OnHScroll () function parameter table is defined as a cscrollbar* type, considering that the same member function is common to the horizontal scroll bar, the pointer variable must be cast to csliderctrl* in the program because the message is actually generated by the slider bar. Type. The message code and meaning of the slider and scroll bar are very similar, such as Tb_bottom, so this method is more reasonable. The SetRange () function is used to set the scope, and the SetPos () function is used to set the current position.