有个图片播放程序,如下..调试了半天,怎么也播不出..编译运行无错误..不知道什么地方有误,请高手指点..估计可能是参数..
最好调试一下,通过后指正..(改好,最好)谢谢了先
Option Explicit
Private lPin As Long
Private strPicsArray() As String
Private ctlPicture As PictureBox
Private WithEvents tmrPics As TimerPrivate Sub Command1_Click()
    '顺序显示图片
    StartShow
End SubPrivate Sub Command2_Click()
    '停止显示图片
    StopShow
End SubPrivate Sub Command3_Click()
    '显示上一幅图片
    ShowPrevious
End SubPrivate Sub Command4_Click()
    '显示下一幅图片
    ShowNext
End SubPrivate Sub Form_Load()
    Dim i As Long
    Set tmrPics = Me.Controls.Add("VB.Timer", "tmrPics")
    SetContainer ctlContainer
    tmrPics.Enabled = False
    tmrPics.Interval = 500
    flPics.Pattern = "*.jpg;*.bmp;*.gif"
    flPics.Path = "f:\11\" '需要的目录
    ReDim strPicsArray(flPics.ListCount - 1)
    For i = 0 To flPics.ListCount - 1
        strPicsArray(i) = flPics.Path & "\" & flPics.List(i)
    Next
End Sub
Private Sub tmrPics_Timer()
    Select Case lPin
    Case Is < LBound(strPicsArray)
lPin = LBound(strPicsArray)
Case Is > UBound(strPicsArray)
        lPin = LBound(strPicsArray)
    End Select
    If ShowPic(lPin) = 0 Then lPin = lPin + 1
End SubPrivate Function SetInterval(ByVal linterval As Long) As Long
    On Error GoTo ErrorHandle
    If linterval > 0 Then
        tmrPics.Interval = linterval
    End If
ErrorHandle:
    SetInterval = Err.Number
End FunctionPrivate Function SetContainer(ByRef ctlContainer As PictureBox) As Long
    On Error GoTo ErrorHandle
    If Not ctlContainer Is Nothing Then Set ctlPicture = ctlContainer
ErrorHandle:
    SetContainer = Err.Number
End FunctionPrivate Function ShowPic(lPic As Long, Optional ByRef ctlContainer As PictureBox = Null) As Long
    On Error GoTo ErrorHandle
    If Not ctlContainer Is Nothing Then
        ctlContainer.Picture = LoadPicture(strPicsArray(lPic))
        '上面这句感觉不大对..
        ctlContainer.Cls
        ctlContainer.Print strPicsArray(lPic)
    Else
        If Not ctlPicture Is Nothing Then
            ctlContainer.Picture = LoadPicture(strPicsArray(lPic))
             '是不是参数不对?
            ctlPicture.Cls
            ctlPicture.Print strPicsArray(lPic)
        End If
    End If
ErrorHandle:
    ShowPic = Err.Number
End FunctionPrivate Function StartShow(Optional ByRef ctlContainer As PictureBox = Null, Optional ByVal linterval As Long = -1) As Long
    On Error GoTo ErrorHandle
    If linterval > 0 Then
        SetInterval linterval
    End If
    If Not ctlContainer Is Nothing Then Set ctlPicture = ctlContainer
    tmrPics.Enabled = True
ErrorHandle:
    StartShow = Err.Number
End FunctionPrivate Function StopShow() As Long
    On Error GoTo ErrorHandle
    tmrPics.Enabled = False
ErrorHandle:
    StopShow = Err.Number
End FunctionPrivate Function ShowPrevious(Optional ByRef ctlContainer As PictureBox = Null) As Long
    StopShow
    Select Case lPin - 1
    Case Is < LBound(strPicsArray) + 1
lPin = UBound(strPicsArray) + 2
Case Is > UBound(strPicsArray)
        lPin = LBound(strPicsArray)
    End Select
    ShowPrevious = ShowPic(lPin - 2, ctlContainer)
    If ShowPrevious = 0 Then
        lPin = lPin - 1
    End If
End FunctionPrivate Function ShowNext(Optional ByRef ctlContainer As PictureBox = Null) As Long
    StopShow
    If lPin < LBound(strPicsArray) Or lPin > UBound(strPicsArray) Then lPin = LBound(strPicsArray)
    ShowNext = ShowPic(lPin, ctlContainer)
    If ShowNext = 0 Then
        lPin = lPin + 1
    End If
End Function