|
-
Mar 8th, 2000, 12:08 PM
#1
Thread Starter
Member
please help me.. i need to know how to make a scroll bar that will scroll through an image on a form... if you can help me thank you very much!
emptywords
-
Mar 8th, 2000, 09:45 PM
#2
Frenzied Member
You will need:
1 picture box
1 image inside the picture box
1 vertical scroll bar
1 horizontal scroll bar
load a picture into the image
and do this:
Code:
Option Explicit
'Mark Sreeves 2000
Private Sub Form_Load()
HScroll1.Max = Image1.Width - Picture1.Width
VScroll1.Max = Image1.Height - Picture1.Height
End Sub
Private Sub HScroll1_Scroll()
Image1.Left = -HScroll1.Value
End Sub
Private Sub VScroll1_Scroll()
Image1.Top = -VScroll1.Value
End Sub
-
Mar 8th, 2000, 10:10 PM
#3
Lively Member
I guess I misunderstood the question. I created a scroll bar that will cycle through images. Oh well, I'll post the code anyway. Maybe somebody can use it and it won't go to waste. :)
1 image control for each picture desired in an array
1 scroll bar, horizontal or verticle depending on preference
Dim iShown As Integer 'Current image shown
Private Sub Form_Load()
Dim i As Integer 'for/next variable
'Hide all other images but the first one
For i = 1 To Image1.UBound Step 1
Image1(i).Visible = False
Next
'sets scroll bar max value
Scroll1.Max = image1.ubound
'sets current picture to the first image
iShown = 0
'Move the image to the desired location
MovePicture (iShown)
End Sub
Private Sub Scroll1_Change()
Dim i As Integer 'Scrollbar value variable
i = Scroll1.Value
'Show picture scrolled to
Image1(i).Visible = True
'Hide previous picture
Image1(iShown).Visible = False
'set new current picture variable
iShown = i
'Move the image to the desired location
MovePicture i
End Sub
Public Sub MovePicture(iSet As Integer)
'Desired location of image
With Image1(iSet)
.Left = 1500
.Top = 500
End With
End Sub
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
|