How to prevent flickering of the previous selected item in a ListView 
Author Message
 How to prevent flickering of the previous selected item in a ListView

I've a Form with 2 ListViews.
Click on an item of ListView1 and then click on an item of ListView2.
Then click on another item of ListView1. Now the item which was selected
before will be highlighted for a short moment before the item you've
just selected gets highlighted.
If you have icons in the ListView this effect is more significant.

Does anyone have any idea how to prevent the flickering of the previous
selected item?
Stefan

***** SAMPLE CODE *****

Option Explicit

Private Sub Form_Load()
  Dim i As Integer

  Form1.Height = 10000
  Form1.Width = 10000

  With ListView1
      .Left = 500
      .Top = 500
      .Width = 4000
      .Height = 9000
      .View = lvwReport
      .GridLines = True
      .HideColumnHeaders = True
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      For i = 1 To 1000
        .ListItems.Add = "Test Item " & i
        .ListItems(i).SubItems(1) = "Test Item " & i
        .ListItems(i).SubItems(2) = "Test Item " & i
        .ListItems(i).SubItems(3) = "Test Item " & i
        .ListItems(i).SubItems(4) = "Test Item " & i
        .ListItems(i).SubItems(5) = "Test Item " & i
      Next
  End With

  With ListView2
      .Left = 5500
      .Top = 500
      .Width = 4000
      .Height = 9000
      .View = lvwReport
      .GridLines = True
      .HideColumnHeaders = True
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      For i = 1 To 1000
        .ListItems.Add = "Test Item " & i
        .ListItems(i).SubItems(1) = "Test Item " & i
        .ListItems(i).SubItems(2) = "Test Item " & i
        .ListItems(i).SubItems(3) = "Test Item " & i
        .ListItems(i).SubItems(4) = "Test Item " & i
        .ListItems(i).SubItems(5) = "Test Item " & i
      Next
  End With
End Sub



Wed, 27 Apr 2005 07:55:53 GMT  
 How to prevent flickering of the previous selected item in a ListView
I've a Form with 2 ListViews.
Click on an item of ListView1 and then click on an item of ListView2.
Then click on another item of ListView1. Now the item which was selected
before will be highlighted for a short moment before the item you've
just selected gets highlighted.
If you have icons in the ListView this effect is more significant.

Does anyone have any idea how to prevent the flickering of the previous
selected item?
Stefan

***** SAMPLE CODE *****

Option Explicit

Private Sub Form_Load()
  Dim i As Integer

  Form1.Height = 10000
  Form1.Width = 10000

  With ListView1
      .Left = 500
      .Top = 500
      .Width = 4000
      .Height = 9000
      .View = lvwReport
      .GridLines = True
      .HideColumnHeaders = True
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      For i = 1 To 1000
        .ListItems.Add = "Test Item " & i
        .ListItems(i).SubItems(1) = "Test Item " & i
        .ListItems(i).SubItems(2) = "Test Item " & i
        .ListItems(i).SubItems(3) = "Test Item " & i
        .ListItems(i).SubItems(4) = "Test Item " & i
        .ListItems(i).SubItems(5) = "Test Item " & i
      Next
  End With

  With ListView2
      .Left = 5500
      .Top = 500
      .Width = 4000
      .Height = 9000
      .View = lvwReport
      .GridLines = True
      .HideColumnHeaders = True
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      .ColumnHeaders.Add
      For i = 1 To 1000
        .ListItems.Add = "Test Item " & i
        .ListItems(i).SubItems(1) = "Test Item " & i
        .ListItems(i).SubItems(2) = "Test Item " & i
        .ListItems(i).SubItems(3) = "Test Item " & i
        .ListItems(i).SubItems(4) = "Test Item " & i
        .ListItems(i).SubItems(5) = "Test Item " & i
      Next
  End With
End Sub



Wed, 27 Apr 2005 08:02:08 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Why does the previous selected item in a ListView get selected for a short moment

2. Preventing Flicker in a listview control

3. jump listview to the hilight item (selected item)...

4. ListView control - Keeping selected items looking selected

5. Q: How to get rid of ListView flicker when adding/removing items

6. ListView control flickers when adding new items

7. ListView control flickers when adding new items

8. How to avoid the flickering of the prior selected line in a ListView

9. Prevent move items in ListView

10. ListView HowTO: prevent the user from checking an item

11. Prevent ListView items being dragged

12. ListView item dragging - how do I prevent it?

 

 
Powered by phpBB® Forum Software