LargeChange and SmallChange Properties Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example uses a scroll bar to move a picture box control across a form.
' To try this example:
' 1. Choose New Project from the File menu
' 2. Choose New Form from the File menu to create a form with:
' • Picture box
' • Horizontal scroll bar
' 3. Press Alt+F4 to return to the programming environment
' 4. Copy the code example below to the form module
' 5. Press F5 to run the example
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 = 3 ' Set color of picture box
END SUB
SUB HScroll1_Change ()
' Move picture according to scroll bar.
Picture1.Left = (HScroll1.Value / 100) * ScaleWidth
END SUB