有这么几个图片文件,001.bmp,002.bmp,003.bmp.....099.bmp现在有一个时钟控件,每隔一秒按以上顺序依次调用图片,请问该如何写代码?

解决方案 »

  1.   

    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
           
      

  2.   

    首先TIMER控件的INTERVAL属性设置成1000
    在TIMER里写下:
    for i=1 to 99
    Picture = LoadPicture(App.Path & "\00" & i & ".bmp")
    next i
      

  3.   

    不好意思,上面我漏了一个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
           
      

  4.   

    标准答案: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
      

  5.   

    在窗体上放置一个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
      

  6.   

    我调试了一下,一下通过
    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
      

  7.   

    上面错,将定义语句放在事件外:
    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
      

  8.   

    我难道没结贴吗?CSDN也总出错呀,我已经结贴了,怎么没看到大家加分呢?