Tree View ImageList and double click

rfazendeiro

Centurion
Joined
Mar 8, 2004
Messages
110
Hi to all,

when i double click in my tree view i change the image that displays, indicating a diferente state of that node. The images are in my imageList, and by default the images index is 0.

Ok. So far so good. I have 2 main problems that are tied together.

1) When i double click the image change only appears when i select another node.

2) When i select a node, the image reverts back to the image that existes by default. When i select another node the image returns to what i had there.


so what can i do to 1) change the image imediatly when i double click the node and 2) how can i, when i select a node, prevent i to revert to the original image


thx to all
 
so after some struggle with the treeview i resolved the problem only to create a new one.

For the 1) problema when i double clik it automaticly changes the image to the next in the image list so its done

for the 2) problem when i interare throught the nodes in the tree view it no longer changes to the default image of the tree view so its done.


To resolve the problems abouve i have to do this

Code:
private void trvModulos_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
       if (this.trvModulos.SelectedImageIndex != e.Node.ImageIndex)
       {
	this.trvModulos.SelectedImageIndex = e.Node.ImageIndex;
       }
}

basicly what i do is change the defaut tree view imagem for the one that the node contains. But the problem is that this refreshes the entire tree view closing all expanded nodes and blinks a little making it wierd.

Is there any way to stop the tree view to refresh when i do this ??

Code:
this.trvModulos.SelectedImageIndex = e.Node.ImageIndex;


thx for the help
 
Back
Top