Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VScrollBar - Value stops 9 before Maximum

Status
Not open for further replies.

keyser456

IS-IT--Management
Nov 21, 2003
73
US
I have a vertical scrollbar (VScrollBar) that I declare like below:

VScrollBar sb = new VScrollBar();
sb.Minimum = 0;
sb.Maximum = 200;
sb.SmallChange = 1;
sb.Value = 0;

Now, when I use the scroll arrows or move the slider the highest I can ever get the value is always the maximum minus 9, even when the slider has reached the bottom of the scrollbar. The odd behavior continues even when I change the maximum either higher or lower.

I trap the Scroll event and check the ScrollEventArgs e.Value, it will never reach any higher than the Maximum minus 9. I *could* offset the maximum by 9 but I think that's pretty lame and would like to find out what's causing this behavior.
 
Anyone? I completely rewrote my control from scratch (for a different reason) and I'm still experiencing this odd scroll bar behavior. Is there something I'm not seeing or am I always going to have to remember to offset the Maximum by +9?
 
Hi,

My guess is that the 9 is the size of the scrollbar slider. The value of the scrolling is the top of tha slider. If you move it to the top, the top of the slider is in 0, but if you move it to the bottom, the bottom of the slider is in 200, but it's top is in 191.
 
Is there any way to change or even just obtain this size of the scrollbar slider/thumb, rather than using the magical number 9? I don't see any properties that expose the slider/thumb at all in the VScrollBar class.

Common sense says when you modify the maximum, the scrollbar does what it takes to make that the true maximum. There should be exactly that many "clicks" on the scrollbar, no more and no less. Am I alone in this reasoning?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top