VB.NET: Scrollbar "button"?
I plan on using a scrollbar for, well, scrolling an image. The image is 200x500, however, the only visible area is 200x250.
So I set the max value to 250, and the min value to 0. The idea is that if I drag the scrollbar's button to the bottom, 250 pixels will have moved for the image, right?
But wait, the scrollbar's button is.... very small. And the scrollbar is actually pretty long. Is there a way to make the scrollbar's开发者_运维技巧 button longer?
How did you create this scrollbar? Is it a separate control all together, or it is a component of another control? I do know that scrollbars added separately act kinda funny at times.
What I would suggest is using the scollbars built into another container control, which should achieve the exact same effect.
- Create a new panel control on your form, and name it. (I suggest something like panelPicture)
- Position the panel where you want your picture to be.
- Set the panel's size to 200x250.
- Set the panel's "Autoscroll" property to True.
- Put a PictureBox inside this panel, and name it. (I suggest something like picMyPicture.)
- Set the PictureBox's position to 0, 0.
- Set the PictureBox's size to 200x500 (or whatever is necessary).
- Set the PictureBox's Image property as desired.
Now, the scrollbar should automatically appear on the picture, and it should look normal.
As a side note (which may or may not be relevant), users typically don't like having to scroll to see the rest of an image, so if you don't need the user to scroll down on the image for some definitive purpose (or because you don't know what the size of the image that will be handled is), I'd try and change the size of things on your form so scrolling will not be necessary.
I hope this helps!
精彩评论