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