tags:

views:

144

answers:

1

Can anyone tell me why the formula for the the actual maximum Value of a vScrollBar control is Maximum + LargeStep -1?

Is there a way to configure the control so that the Value is 0 when the scroll bar is at the bottom of the screen?

+1  A: 

LargeChange is the size of the button that slides in a vScrollBar. Since the top part of the slider cannot slide all the way to the bottom, the maximum change is the vScrollBar.Maximum minus the size of the slider, and the size of the slider is set to be equal to the LargeChange.

You can set the minumum to be zero (plus largeCharge plus 1) to get it the be zero at the bottom. However, the other values will be negative. Maybe a better way is to subtract the value from the maximum in the scroll event and assign that to a variable:

scrollValue = VScrollBar1.Maximum - VScrollBar1.Value - VScrollBar1.LargeChange + 1

You may want to add the LargeValue to the vScrollBar1.Maximum.

xpda
This problem arose from an existing program I was maintaining that was using scroll bars. Your answer has been helpful in providing insight into why the code was so complex. Changing the scroll bars to task bars made things cleaner. Thank you.
tkyle