Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Reduce flicker in ListView ?

Reduce flicker in ListView ?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionannouncement
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _skidrow_vn_
    wrote on last edited by
    #1

    I have 20 items in my List View and I update them rapidly (change text of subitem) interval = 100millisecond (report type only) They are very flicker Is there a way to fix it ? VC6,XP thank a lot ~!

    D 1 Reply Last reply
    0
    • _ _skidrow_vn_

      I have 20 items in my List View and I update them rapidly (change text of subitem) interval = 100millisecond (report type only) They are very flicker Is there a way to fix it ? VC6,XP thank a lot ~!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you looked at CWnd::SetRedraw()?


      Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

      S 1 Reply Last reply
      0
      • D David Crow

        Have you looked at CWnd::SetRedraw()?


        Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

        S Offline
        S Offline
        Signal 9
        wrote on last edited by
        #3

        you can derive and write you own CView::OnUpdate() function... since CListView is derived from the CView Class. this will allow you to redraw only part of the View. The default OnUpdate() is to redraw the entire client area. This is exactly what you need to do to reduce flickering.

        D 1 Reply Last reply
        0
        • S Signal 9

          you can derive and write you own CView::OnUpdate() function... since CListView is derived from the CView Class. this will allow you to redraw only part of the View. The default OnUpdate() is to redraw the entire client area. This is exactly what you need to do to reduce flickering.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Two calls to CWnd::SetRedraw() takes far less code, however!


          Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

          S 1 Reply Last reply
          0
          • D David Crow

            Two calls to CWnd::SetRedraw() takes far less code, however!


            Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

            S Offline
            S Offline
            Signal 9
            wrote on last edited by
            #5

            If you derive from CView you get more control over the drawing... you can set the icons and text descriptions to go with them. If you override the CWnd class then you cannot.

            D 1 Reply Last reply
            0
            • S Signal 9

              If you derive from CView you get more control over the drawing... you can set the icons and text descriptions to go with them. If you override the CWnd class then you cannot.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              CListView is already derived from CView. More control over the drawing is not required, and I did not mention anything about "overriding the CWnd class", however you would do that. I'm assuming the OP had something akin to the following for populating the listview:

              for (int x = 0; ...)
              {
              listview.InsertItem(...);
              }

              Simply changing it to the following will keep the control from flickering:

              listview.SetRedraw(FALSE);
              for (int x = 0; ...)
              {
              listview.InsertItem(...);
              }
              listview.SetRedraw(TRUE);


              Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

              S 1 Reply Last reply
              0
              • D David Crow

                CListView is already derived from CView. More control over the drawing is not required, and I did not mention anything about "overriding the CWnd class", however you would do that. I'm assuming the OP had something akin to the following for populating the listview:

                for (int x = 0; ...)
                {
                listview.InsertItem(...);
                }

                Simply changing it to the following will keep the control from flickering:

                listview.SetRedraw(FALSE);
                for (int x = 0; ...)
                {
                listview.InsertItem(...);
                }
                listview.SetRedraw(TRUE);


                Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

                S Offline
                S Offline
                Signal 9
                wrote on last edited by
                #7

                The flickering will still occur, since he is updating the client area every 100 milliseconds. Thats why i said to override. If he uses the default setdraw, it will update and draw the whole client area, which will still flicker.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups