How do I label the minimum, maximum, center ticks in a .net 3.5 trackbar?

Curt picture Curt · May 24, 2011 · Viewed 13.3k times · Source

I need to set a voltage in an application. I'm used to using sliders in Labview, and would like to replicate that using a C# program.

I've figured out that the track bar only does integer values, so rather than have the range go from -5 to 5 using a double, I need to have the track bar go from -50 to +50 with tick marks every 10 steps to get 0.1v resolution.

How do I label the track bar minimum and maximum values?

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|
-5.0                           0.0                              5.0

I'm using C# with .net 3.5 with Visual Studio.

Answer

Smudge202 picture Smudge202 · May 24, 2011

The easiest way would be to add to 2-3 labels, using a combination of height/width/top/left of the trackbar and labels you should be able to position them relatively without too much hassle?

EDIT: Also, it seems this post shows a custom implementation with the same requirements as you've described?