
PictureBox with ScrollBars?
Hi Marcos,
Your reply was very helpful, but I am still having some difficulties.
When I scroll, the innermost picture moves alright but it moves beyond
it's width or height until it disapppears (which I don't want that to
happen). Also, when I get to the middle of the innermost picture, the
scroll bar should also be somewhere in the middle, which
in this case does not happen.
I have included some of the code below.
Thanks again...
Arthur
------------------------------------
'This is the form
Private Sub Form_Load()
Picture2.Picture = LoadPicture("Pic.BMP")
Picture2.AutoSize = True
HScroll1.Max = Picture2.Width
HScroll1.Min = 0
HScroll1.Value = 0
'To store the previous value of HScroll1.Value
OldVal = HScroll1.Value
End Sub
---------------------------------
'This is the outermost PictureBox
Private Sub Picture1_Resize()
Picture1.Height = Form1.Height
Picture1.Width = Form1.Width
End Sub
--------------------------------
'This is the horizontal scroll bar
Private Sub HScroll1_Change()
Dim NewVal
NewVal = HScroll1.Value
'If HScroll1.Value is increased, the picture2 moves
'to left or else to the right
If OldVal < NewVal Then
Picture2.Move Picture2.Left - HScroll1.Value
Else
Picture2.Move Picture2.Left + HScroll1.Value
End If
OldVal = HScroll1.Value
End Sub
'The verrtical scroll bar will almost be the same
---------------------------------