How to compensate for scrollbar.max of 32767 using visual basic 6
Posted on 2004-09-25
I'm using VB6 and am trying to compensate for the scrollbar max of 32767. Here's what I'm trying to do. I have a picture control within a picture control. Let's call the outside picture control picContainer and the picture control within it picChild. It's set up so that at design time if I move picContainer, picChild also moves. My form is being used to view images and picChild is what contains the images. When an image is loaded, picChild is resized to the size of the picture. When picChild is larger than picContainer, picContainer contains a vertical scrollbar so that I can move picChild up and down to see the image (I'm just worrying about the vertical right now, forget about the horizontal). I set my scrollbar (called fsb, for flat scroll bar) settings as follows:
fsb.Max = picChild.Height - picContainer.Height
fsb.SmallChange = Abs(fsb1.Max \ 16) + 1
fsb.LargeChange = Abs(fsb1.Max \ 4) + 1
The program works perfectly except for when (picChild.Height - picContainer.Height) > 32767, the largest value the scrollbar max property can handle. Attempting to set the max beyond that value of course causes an error to be generated.
Any ideas as to how to compensate for this max of 32767 so that I can still scroll to see the entire picture? My goal is to be able to scroll up and down to see the entire picture but not scroll beyond the picture dimensions (I don't want the bottom of the picture scrolling up passed the top of the screen).
Looking forward to your replies.