我想做出不同的image中同时现实不同的图片,应该怎么该?(附代码)
我想做出不同的image中同时现实不同的图片,应该怎么该?代码如下:
Dim mintVegetableState(10) As Integer
Private Function getRndDigit(intUpperbound As Integer, intLowerbound As Integer) As Integer
Randomize
getRndDigit = Int((intUpperbound - intLowerbound + 1) * Rnd + intLowerbound)
End Function
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 10
mintVegetableState(i) = 1
Next i
tmrChange.Interval = 100
End Sub
Private Sub Image6_Click()
End Sub
Private Sub tmrChange_Timer()
Dim intVegetableIndex As Integer
intVegetableIndex = getRndDigit(10, 0)
Set Image(intVegetableIndex).Picture = LoadPicture(App.Path & "\ng" & Trim(Str(mintVegetableState(intVegetableIndex))) & ".gif")
就是这个老提示出错,什么情况?
mintVegetableState(intVegetableIndex) = mintVegetableState(intVegetableIndex) + 1
If mintVegetableState(intVegetableIndex) > 6 Then
mintVegetableState(intVegetableIndex) = 1
End If
tmrChange.Interval = getRndDigit(3, 1) * 500
End Sub