Private Sub Form_Load() Timer1.Interval=1000 Timer1.Enabled=True End SubPrivate Sub Timer1_Timer() Static i as Integer if i=100 then timer1.enabled=false exit sub Select Case i Case i<10 and i>0 Picture1.Picture=LoadPicture("C:\00" & Str(i) & ".bmp") Case i>=10 Picture1.Picture=LoadPicture("c:\0" & Str(i) & ".bmp") end select i=i+1 End Sub
首先TIMER控件的INTERVAL属性设置成1000 在TIMER里写下: for i=1 to 99 Picture = LoadPicture(App.Path & "\00" & i & ".bmp") next i
不好意思,上面我漏了一个end if更正如下:Private Sub Form_Load() Timer1.Interval=1000 Timer1.Enabled=True End SubPrivate Sub Timer1_Timer() Static i as Integer if i=100 then timer1.enabled=false exit sub End IfSelect Case i Case i<10 and i>0 Picture1.Picture=LoadPicture("C:\00" & Str(i) & ".bmp") Case i>=10 Picture1.Picture=LoadPicture("c:\0" & Str(i) & ".bmp") end select i=i+1 End Sub
标准答案:public i '全局量form_load事件 timer1.INTERVAL=1000 timer1.enable=true i=0在TIMER里写下: i=i+1 if i<=99 then Picture = LoadPicture(App.Path &"\" & format(i,"000") & ".bmp") else i=0 end if
在窗体上放置一个Picturebox,并添加如下代码: Private Sub Timer1_Timer() Dim tStr As String Dim i As Integer i = i + 1 If i > 99 Then i = 1 tStr = "your path\" & Format(i, "000") & ".bmp" Picture1.Picture = LoadPicture(tStr) End Sub
我调试了一下,一下通过 Public i As Integer Private Sub Form_Load() Timer1.Interval = 100 Timer1.Enabled = True End SubPrivate Sub Timer1_Timer() If i <= 99 Then Picture1.Picture = LoadPicture(app.path & "\" & Format(i, "000") & ".gif") Else i = 0 End If i = i + 1 End Sub
上面错,将定义语句放在事件外: Dim i As IntegerPrivate Sub Timer1_Timer() Dim tStr As String i = i + 1 If i > 99 Then i = 1 tStr = "your path\" & Format(i, "000") & ".bmp" Picture1.Picture = LoadPicture(tStr) End Sub
Timer1.Interval=1000
Timer1.Enabled=True
End SubPrivate Sub Timer1_Timer()
Static i as Integer
if i=100 then
timer1.enabled=false
exit sub
Select Case i
Case i<10 and i>0
Picture1.Picture=LoadPicture("C:\00" & Str(i) & ".bmp")
Case i>=10
Picture1.Picture=LoadPicture("c:\0" & Str(i) & ".bmp")
end select
i=i+1
End Sub
在TIMER里写下:
for i=1 to 99
Picture = LoadPicture(App.Path & "\00" & i & ".bmp")
next i
Timer1.Interval=1000
Timer1.Enabled=True
End SubPrivate Sub Timer1_Timer()
Static i as Integer
if i=100 then
timer1.enabled=false
exit sub
End IfSelect Case i
Case i<10 and i>0
Picture1.Picture=LoadPicture("C:\00" & Str(i) & ".bmp")
Case i>=10
Picture1.Picture=LoadPicture("c:\0" & Str(i) & ".bmp")
end select
i=i+1
End Sub
timer1.INTERVAL=1000
timer1.enable=true
i=0在TIMER里写下:
i=i+1
if i<=99 then
Picture = LoadPicture(App.Path &"\" & format(i,"000") & ".bmp")
else
i=0
end if
Private Sub Timer1_Timer()
Dim tStr As String
Dim i As Integer
i = i + 1
If i > 99 Then i = 1
tStr = "your path\" & Format(i, "000") & ".bmp"
Picture1.Picture = LoadPicture(tStr)
End Sub
Public i As Integer
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
End SubPrivate Sub Timer1_Timer() If i <= 99 Then
Picture1.Picture = LoadPicture(app.path & "\" & Format(i, "000") & ".gif")
Else
i = 0
End If
i = i + 1
End Sub
Dim i As IntegerPrivate Sub Timer1_Timer()
Dim tStr As String
i = i + 1
If i > 99 Then i = 1
tStr = "your path\" & Format(i, "000") & ".bmp"
Picture1.Picture = LoadPicture(tStr)
End Sub