' Wyo VB Ch. 8 Demo #8
' Mr. Minich
' This program illustrates the use of a control array, a timer control,
'   a picture control, and animation.

Option Explicit Private Sub Command1_Click(Index As Integer) If Index = 0 Then label1.BackColor = vbCyan ElseIf Index = 1 Then label1.BackColor = vbRed ElseIf Index = 2 Then label1.BackColor = vbGreen End If End Sub Private Sub cmdStop_Click() tmrAnimate.Enabled = False End Sub Private Sub cmdStart_Click() tmrAnimate.Enabled = True End Sub Private Sub Form_Load() tmrAnimate.Interval = 100 ' 1/10 second tmrAnimate.Enabled = False ' Must turn off timer since timer's ' are enabled by default. End Sub Private Sub tmrAnimate_Timer() Dim DeltaX As Integer ' Change in x position of picture box DeltaX = 10 ' The number of twips that the picture box ' will move each time that this event ' procedure executes. pctButterfly.Move pctButterfly.Left + DeltaX, pctButterfly.Top ' moving the picture to the right by the amount of mDelta X End Sub