I have a picture box, filled with a list of labels. I'm currently using two buttons to scroll the list up and down. I want to use the scrollbars instead, but dont know where to start.
Any tips?
Printable View
I have a picture box, filled with a list of labels. I'm currently using two buttons to scroll the list up and down. I want to use the scrollbars instead, but dont know where to start.
Any tips?
Code:Private Sub Form_Load()
VScroll1.Min = 0
VScroll1.Max = 50
End Sub
Private Sub VScroll1_Change()
Label1.Top = VScroll1.Value
End Sub
Private Sub VScroll1_Scroll()
Call VScroll1_Change
End Sub
I really didn't understand what you meant by Labels for a picture box. But anyway trying an array and use Value property of Scroll Bar for showing the element at a particular index
Hi
I think what you are after is to display labels in a picture box and to have the whole display scroll as you click the scroll bars. This is achieved by having a picture box within a picture box and scrolling accordingly. I have given a very basic example but you can experiment and add features as required. Pls note that you should also consider whether scrolling data is really necessary in your design because it sometimes confuses users.
Example... On Form1 Add a Picture box (Picture1)... INSIDE this picture box add a Vertical Scroll bar (VScroll1) on the right side of the picture. Again INSIDE Picture 1 add another Picture box (Picture2)... This now makes Picture1 the container for Picture 2 and VScroll1. Now add this code
VB Code:
Private Sub Form_Load() Picture1.Height = 3000 Picture2.Height = 5000 VScroll1.Height = 3000 VScroll1.Min = 0 VScroll1.Max = (Picture2.Height - Picture1.Height) / 100 End Sub Private Sub VScroll1_Change() Picture2.Top = -VScroll1.Value * 100 End Sub
As I said, this is VERY basic and you can adjust as required.
Regards
Stuart
Thanks all
Good , to-the-point explanation Stuart.
TO_raptor
TO_raptor what do you want to do maybe we can help you more and for basic question you can go to the microsoft help there : Microsoft Free Help
Hi there,
I was complimenting stuart for his explanation. thats all.
I ll be more descriptive when i have a question.
thanks for your hyperactive concern DAOK :)
good luck!