I am trying to duplicate the behaviour of PAINT application in Win 7 zoom track bar:
(I know it’s a common track bar control)

The 100% is located in the center.
and it has 11 available positions:

etc…
12.5%, 25%, 50%, 100%, 200%, 300%, 400%, 500%, 600%, 700%, 800%
So my zoom values (ZoomArray) are:
0.125, 0.25, 0.5, 1, 2, 3, 4, 5, 6, 7, 8
That’s easy I could set Min to 1 and Max to 11 and get the values I need:
ZoomArray[TrackBar1.Position]
The question is how to keep 100% in the center and the only positions that are available are the one above?
I have tried to use dummy values in the array to keep the 1 in the center e.g.:
0.125, 0.25, 0.5, -1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8
And reposition the trackbar on Change event, but my logic doesnt seem to work right.
Any ideas?
Here is one alternative that derives a new control from
TTrackbar, removing the automatic tics and handling sliding in the scroll message, behaves nearly identical to the control in Paint. Compiled with D2007, tried to comment a little:Vertical implementation would be similar, if needed. This is not really a finished product, just a trial to mimic the behavior of the mentioned control.