Have you tried a forum search for scrollbar examples?
Here's one of my snippets
And another
And here's my GUI tutorial covering all sorts of stuff:
http://dbcodecorner.com/?page=tutorials
So I'm guessing you want the scrollbar to resize but according to how much data is in the window?
view = how much you can see in your window
total = how much total data there is to see
Calculate the percent of how much of the content is visible (Between 0.0 and 1.0, you'll want add a check to make sure it doesn't go over 1)
t# = view/total
max = maximum size of your scrollbar (technically called the scrollbar's thumb. The thumb slides along the track) This can be as large as the view size or less.
This is the size of your scrollbar thumb
sbSize = max * t#
Make one last check to make sure your
sbSize isn't too small.
"You're not going crazy. You're going sane in a crazy world!" ~Tick