SelectedImageIndex in Treeview

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Why in the heck does VB.NET want to set the SelectedImageIndex any time I
set the ImageList for my treeview?!? Yes, I want to have images for the
nodes, but I don't want an image to be displayed whenever I select a node. I
simply want it to simply show the same image that is on the node. And once
you set the ImageList, you can set the SelectedImageIndex to None/Nothing!!!

I thought I could do it a hokey way by setting the SelectedImageIndex in the
AfterSelect event; however that causes the tree to flash (even when
Suspending and Resuming the layout). Then I found this in the help:
-------------
Note: When setting the SelectedImageIndex property at run time, the
TreeView handle is recreated (see Control.RecreateHandle) to update the
control's appearance. This causes all tree nodes to be collapsed, with the
exception of the selected TreeNode.
-------------

So it appears I can't use that reliably. Anyone know how I can 'turn off'
the SelectedImage but still use an imagelist for the treeview?

Tom
 
Never mind, I figured it out.... turns out, when you create the node, you
not only have to set the ImageIndex but also the NODE's
SelectedImageIndex... I just set them to the same thing and now it works
fine.

Still wierd, though....

Tom
 
Back
Top