Dim i As Integer Private Sub Command1_Click() Dim strFile As Stringi = 1 strFile = Dir("D:\Documents and Settings\Administrator\My Documents\My Pictures\*.gif") Do Until strFile = "" Image1.Picture = LoadPicture("D:\Documents and Settings\Administrator\My Documents\My Pictures\" & strFile) ImageList1.ListImages.Add i, "t" & CStr(i), Image1.Picture strFile = Dir() i = i + 1 Loop Timer1.Enabled = True i = 1 End SubPrivate Sub Timer1_Timer() If ImageList1.ListImages.Count >= i Then Image1.Picture = ImageList1.ListImages(i).Picture Me.Refresh i = i + 1 If i > ImageList1.ListImages.Count Then i = 1 End If
'从ImageList控件中装载图片:
Image1.Picture=ImageList1.ListImages(i).Picture 'i是编号
上面那个例子有说明。
Private Sub Command1_Click()
Dim strFile As Stringi = 1
strFile = Dir("D:\Documents and Settings\Administrator\My Documents\My Pictures\*.gif")
Do Until strFile = ""
Image1.Picture = LoadPicture("D:\Documents and Settings\Administrator\My Documents\My Pictures\" & strFile)
ImageList1.ListImages.Add i, "t" & CStr(i), Image1.Picture
strFile = Dir()
i = i + 1
Loop
Timer1.Enabled = True
i = 1
End SubPrivate Sub Timer1_Timer()
If ImageList1.ListImages.Count >= i Then
Image1.Picture = ImageList1.ListImages(i).Picture
Me.Refresh
i = i + 1
If i > ImageList1.ListImages.Count Then i = 1
End If