This example uses a scroll bar to move a PictureBox control across the form. To try this example, paste the code into the Declarations section of a form that contains a small PictureBox control and an HScrollBar control, and then press F5 and click the scroll bar.
Private Sub Form_Load ()
HScroll1.Max = 100 ' Set maximum value.
HScroll1.LargeChange = 20 ' Cross in 5 clicks.
HScroll1.SmallChange = 5 ' Cross in 20 clicks.
Picture1.Left = 0 ' Start picture at left.
Picture1.BackColor = QBColor(3) ' Set color of picture box.
End Sub
Private Sub HScroll1_Change ()
' Move picture according to scroll bar.
Picture1.Left = (HScroll1.Value / 100) * ScaleWidth
End Sub