Round slider control

I needed a round slider control to let my users enter an angle. I
thought this could be useful to others, so I wrote a general class
for it using some of the functions from Chris Maunder’s
CRoundButton class.

To use, simply add a slider to your dialog. Enlarge it until it covers an approximately square area.

In your dialog class, associate a control variable (say m_rscMySlider), with the slider. If you have told class wizard about CRoundSliderCtrl, you will be able to select it when you define the control variable. If not, just go for CSliderCtrl and manually edit the definition in your dialog header file, changing CSliderCtrl to CRoundSliderCtrl. If you do not like using DDX then you can just subclass the control.

In OnInitDialog() you would call SetRange(), SetPos(), etc. to customize the look and feel of the round slider control.

Download demo project – 39.2 Kb

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read