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#
  4. TreeView flickering?

TreeView flickering?

Scheduled Pinned Locked Moved C#
csharpwinformshelpquestion
3 Posts 2 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.
  • C Offline
    C Offline
    Cyrilix
    wrote on last edited by
    #1

    So, I've essentially implemented a folder browser with a TreeView, and what I'm doing is trying to get it to remove flickering. Here's how it works: Initially, say my folder structure starts like this, and the node that I want to refresh (folder nodes labeled with dots except for root) is indicated:

    Root
    |
    |__. (node to be refreshed)
    | |
    | |__.
    | |
    | |__.
    |
    |__.

    When I try to do the refresh, it ends up like this after I delete all the subnodes:

    Root
    |
    |__. (in the process of being refreshed)
    |
    |__.

    Then, it ends up like the initial diagram again. The problem is, I'm getting screen flickering everytime I do this operation. I've tried using TreeView.BeginUpdate() before calling the refresh, then TreeView.EndUpdate() after the refresh is done. Even when no folders have changed at all (i.e. the treeview ends up looking exactly the same in my Winforms application), I get the flicker. My assumption was that if the image on-screen didn't change, then nothing would have to be redrawn (thereby avoiding flicker). If not, then what assumptions can I make, and would there be any tips on solving this problem? Also, note that TreeView.DoubleBuffered doesn't actually do anything for this control.

    A 1 Reply Last reply
    0
    • C Cyrilix

      So, I've essentially implemented a folder browser with a TreeView, and what I'm doing is trying to get it to remove flickering. Here's how it works: Initially, say my folder structure starts like this, and the node that I want to refresh (folder nodes labeled with dots except for root) is indicated:

      Root
      |
      |__. (node to be refreshed)
      | |
      | |__.
      | |
      | |__.
      |
      |__.

      When I try to do the refresh, it ends up like this after I delete all the subnodes:

      Root
      |
      |__. (in the process of being refreshed)
      |
      |__.

      Then, it ends up like the initial diagram again. The problem is, I'm getting screen flickering everytime I do this operation. I've tried using TreeView.BeginUpdate() before calling the refresh, then TreeView.EndUpdate() after the refresh is done. Even when no folders have changed at all (i.e. the treeview ends up looking exactly the same in my Winforms application), I get the flicker. My assumption was that if the image on-screen didn't change, then nothing would have to be redrawn (thereby avoiding flicker). If not, then what assumptions can I make, and would there be any tips on solving this problem? Also, note that TreeView.DoubleBuffered doesn't actually do anything for this control.

      A Offline
      A Offline
      Anthony Mushrow
      wrote on last edited by
      #2

      Well, calling BeginUpdate should stop all drawing and I don't think there's much more you could try. The best thing I can think of is to create a new, temporary node and use that to do all the 'refreshing' on, then simply replace the old node. To be honest though I don't think it will be much help.

      My current favourite word is: Nipple!

      -SK Genius

      Game Programming articles start -here[^]-

      C 1 Reply Last reply
      0
      • A Anthony Mushrow

        Well, calling BeginUpdate should stop all drawing and I don't think there's much more you could try. The best thing I can think of is to create a new, temporary node and use that to do all the 'refreshing' on, then simply replace the old node. To be honest though I don't think it will be much help.

        My current favourite word is: Nipple!

        -SK Genius

        Game Programming articles start -here[^]-

        C Offline
        C Offline
        Cyrilix
        wrote on last edited by
        #3

        Thanks for the reply. I found a way to do it by overriding WndProc, so I may use that, even though it doesn't seem like the nicest solution.

        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