TreeView.TreeNode.Image.Refresh();

  • Thread starter Thread starter Mark Jerde
  • Start date Start date
M

Mark Jerde

VS .NET 2003, Googling, msdn searching not successful.

I'm using the images of nodes of a TreeView to show the Pass/Fail results of
several tests. The tests are a little slow so I would like to Refresh()
between each test. This works:

MyTreeView.Refresh();

.... but it causes a lot of flicker. The node text does not change. Only
the TreeNode.ImageIndex changes.

Is there a way to refresh just the image portion of a TreeNode?

Thanks.

-- Mark
 
Mark,
Is there a way to refresh just the image portion of a TreeNode?

You can try something like

MyTreeView.Invalidate(someNode.Bounds);
MyTreeView.Update();

Unlike Refresh this will only invalidate and redraw that one node's
area. You can shrink the rectangle returned by Bounds to only cover
the image if you can figure out where exactly the image is located.


Mattias
 
Mattias -- Excellent! Thanks!

-- Mark

Mattias Sjögren said:
Mark,


You can try something like

MyTreeView.Invalidate(someNode.Bounds);
MyTreeView.Update();

Unlike Refresh this will only invalidate and redraw that one node's
area. You can shrink the rectangle returned by Bounds to only cover
the image if you can figure out where exactly the image is located.


Mattias
 
Back
Top