• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

Changing TreeNode Images

hi

i have a TreeView that contains various TreeNodes

i have set the ImageIndex to a closed folder image, and the SelectedImageIndex to an open folder image.

this works fine when i double click the treenode, the images swap around... BUT when I use the expan/collapse feature of the TreeView (ie the + and - icons), the images don't change...

any ideas?

cheers,
0
A4eIT
Asked:
A4eIT
1 Solution
 
manchCommented:

Actually when u expand or collapse the Tree View Nodes the Node is not Selected so the SelectedImageIndex won't work for that

SelectedImageIndex is basically when the node is selected then the image is displayed

(Try to select the Node u want it will work fine u have to find the Index of the Node and then set the SelectedNode property of the TreeView to that paritcular node)

Try it
0
 
A4eITAuthor Commented:
many thanks

please could you advise me how to do that? what event fires when i click on the '+' or '-'?

thx
0
 
doraiswamyCommented:
When you click +, the 'beforeexpand' event fires, the nodes expand and then the 'afterexpand' event fires. Similarly, the - has 'beforecollapse' and 'aftercollapse' events.
0
 
Éric MoreauSenior .Net ConsultantCommented:
Hi A4eIT,

I have written an article on that in April 2006 that you can read from http://emoreau.s2i.com/

Cheers!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now