2个回答
展开全部
'所用控件:drivelistbox,dirlistbox,filelistbox,timer,commandbutton,image, 名称均为默认
Private Sub Command1_Click()
If Command1.Caption = "自动播放" Then
Timer1.Enabled = True
Command1.Caption = "停止播放"
Else
Timer1.Enabled = False
Command1.Caption = "自动播放"
End If
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.List(File1.ListIndex))
End Sub
Private Sub Form_Load()
Command1.Caption = "自动播放"
Timer1.Interval = 3000
File1.Pattern = "*.jpg;*.bmp;*.gif"
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If File1.ListCount = 0 Then
Timer1.Enabled = False
Else
If File1.ListIndex = -1 Then File1.ListIndex = 0
End If
Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.List(File1.ListIndex))
If File1.ListIndex = File1.ListCount - 1 Then
File1.ListIndex = 0
Else
File1.ListIndex = File1.ListIndex + 1
End If
End Sub
Private Sub Command1_Click()
If Command1.Caption = "自动播放" Then
Timer1.Enabled = True
Command1.Caption = "停止播放"
Else
Timer1.Enabled = False
Command1.Caption = "自动播放"
End If
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.List(File1.ListIndex))
End Sub
Private Sub Form_Load()
Command1.Caption = "自动播放"
Timer1.Interval = 3000
File1.Pattern = "*.jpg;*.bmp;*.gif"
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If File1.ListCount = 0 Then
Timer1.Enabled = False
Else
If File1.ListIndex = -1 Then File1.ListIndex = 0
End If
Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.List(File1.ListIndex))
If File1.ListIndex = File1.ListCount - 1 Then
File1.ListIndex = 0
Else
File1.ListIndex = File1.ListIndex + 1
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询