Hi,
Im trying to load animated GIF's from a folder to my listview, I'm able to load it but not moving
One more problem is, a lot of GIF are inside that folder,but the display in listview show the same image

how can i fix it, is there better way how to load animated GIF to listvew?

here's my code

 lvSmiley.Items.Clear()
        Dim imlTemp As New ImageList
        Dim dirFiles() As String = IO.Directory.GetFiles("C:\Program Files (x86)\Emotes")
        Dim _imgList As New ImageList
        Dim imgSize As New Size
        imgSize.Width = 20
        imgSize.Height = 50
        lvSmiley.LargeImageList = _imgList
        Dim count As Integer = 0
        Dim item As New ListViewItem
        For Each dirFile As String In dirFiles
            Dim imgFilename As String = IO.Path.GetFileNameWithoutExtension(dirFile)
            Dim img As New System.Drawing.Bitmap(dirFile)
            Dim imgImage As Image = Image.FromFile(dirFile)
            'Dim imgHeight As Integer
            'imgHeight = imgImage.Height
            imgSize.Height = imgImage.Height
            _imgList.ImageSize = imgSize
            _imgList.Images.Add(img)
            lvSmiley.Items.Add(imgFilename, count)
            count += 1

Thanks in advance

If using the default .NET ListView, which I don't think supports gifs, you will not be able to see any animation.

You can use something like this.

Hope this points you in the right dir. :)

thanks for the reply

One quick question, since defualt listview does not support gif, what control can i use to display this gif's from a directory" Is webBrowser good to go?

Thanks again

Using the WebBrowser would be the easiest solution. The problem being with it is that the scroll bars will be in sight.

You can set the document with something like this:

WebBrowser1.DocumentText = "<html> <body> <img src=""PathToMyGIF""Height='300' Width='300'> </body> </html>"

I've been trying to use this web browser but i can't figure out how to display those gif's from a folder. It does'nt even show the gif? I'm making a simple IM for our office, and I just want to display animated smiley's. Could you please help me

Thanks

This article has been dead for over six months. Start a new discussion instead.