Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sets the length of the slider in the current trackbar control.
void SetThumbLength(
int nLength
);
Parameters
Parameter |
Description |
---|---|
[in] nLength |
Length of the slider, in pixels. |
Remarks
This method requires that the trackbar control be set to TBS_FIXEDLENGTH style.
This method sends the TBM_SETTHUMBLENGTH message, which is described in the Windows SDK.
Requirements
Header: afxcmn.h
Example
The following code example defines the variable, m_sliderCtrl, that is used to access the current trackbar control. The example also defines a variable, thumbLength, that is used to store the default length of the trackbar control's thumb component. These variables are used in the next example.
// Variable to access the slider control.
CSliderCtrl m_sliderCtrl;
// Lenght of the slider control's thumb.
int thumbLength;
The following code example sets the trackbar control's thumb component to twice its default length.
// Add extra initialization.
// Modify the size of the slider control's thumb.
// First, set the TBS_FIXEDLENGTH style.
m_sliderCtrl.ModifyStyle( 0, TBS_FIXEDLENGTH );
thumbLength = m_sliderCtrl.GetThumbLength();
m_sliderCtrl.SetThumbLength( thumbLength * 2 );
// End extra initialization.