|
-
Jul 21st, 2001, 12:26 PM
#1
Thread Starter
Junior Member
ScrollBars, how do I use them
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?
-
Jul 21st, 2001, 03:07 PM
#2
Hyperactive Member
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
[vbcode]
' comment
Rem remark
[/vbcode]
-
Jul 21st, 2001, 03:07 PM
#3
Fanatic Member
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
-
Jul 21st, 2001, 06:58 PM
#4
PowerPoster
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
-
Jul 22nd, 2001, 11:42 AM
#5
Thread Starter
Junior Member
-
Sep 10th, 2001, 03:56 PM
#6
New Member
Stuart
Good , to-the-point explanation Stuart.
TO_raptor
-
Sep 10th, 2001, 04:32 PM
#7
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
-
Sep 10th, 2001, 04:37 PM
#8
New Member
last post rephrase
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|