请问如何将某个目录里的图片文件加载到imagelist里?然后再用image控件依次显示出来?谢谢了,苦恼好长时间了。

解决方案 »

  1.   

    在imagelist里面把你的图片一张张地手工添加进去,可以使image旋转起来。在一个Timer事件中执行。
      

  2.   

    谢谢回复,不过我是想用代码来读入,因为不知道目标文件夹具体有多少图片,还有图片也许不固定,因为一旦编译了就不能再手动添加了。那个让image显现的能具体做个示例么?我是初学者……谢谢!
      

  3.   

    参见如何做旋转的光盘动画  http://www.knowsky.com/337164.html
      

  4.   

    '如果文件名有规律就好办。比如,都是picture开头的文件:picture1,picture2,picture3,picture4...。
    '从ImageList控件中装载图片: 
    Image1.Picture=ImageList1.ListImages(i).Picture 'i是编号
    上面那个例子有说明。
      

  5.   

    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