Dear People,

I want to use the ListView with larger images.
For this I use the ImageList with images of 120x80 pixels.
Now for each ListItem I have two images.
With a timer I want to alternate the imahes like:

Private Sub Timer1_Timer()
Dim i As Integer

  For i = 1 To ListView1.ListItems.Count
    If ListView1.ListItems(i).Icon = 1 Then
      ListView1.ListItems(i).Icon = 2
    Else
      ListView1.ListItems(i).Icon = 1
    End If
  Next i
End Sub

This works perfectly. Except that on some displays it flickers visibly.
This happens on a larger window with about 50 images.
It appears to redraw the complete contents.

Has anyone a suggestion what I can do about this.

I should add that (unfortunately) I use Visual Basic v4.0.

Thanks in advance, Jean Pion.

Try to change your form Redraw property to true. This should eliminate most of the flicker. The problem is that the flicker is created by your timer, it loads the pic every time the call is made, hence the flicker. A quick work around would be to add another timer and use that to start timer1, when pic loaded, disable it, let the timer2 enable it again and so on.

Thanks AndreRet,

I will try AutoRedraw and will report if it helps.

Not sure what you mean with the Timer though.
The timer has a reload value of 1000 mSec.
So the swap of the images will only happen once a second.
But each second ListView1.ListItems.Count images will be updated.

No problem. Let me know if it helped with the flicker.:)

Post your page here as a zip file, I'll have to see exactly what you have on the page and then try to correct it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.