Pregunta

I have a ImageList assigned in Stateimages of a Virtual Treeview. How can I change the stateindex of a root node? I can't find anything. Thank you for your help.

¿Fue útil?

Solución

You need to implement the OnGetImageIndex event. There you can set the var ImageIndex to the index of your image in the ImageList.

Should you need to only apply to root nodes, you can check if the nodes parent = nil.

From the help:

10.1.2.104 TBaseVirtualTree.OnGetImageIndex Event

property OnGetImageIndex: TVTGetImageEvent; Description

This event is triggered whenever the tree needs the index of an image, be it the normal, the selected or the state image. The event should be as fast as possible because it is at times frequently called when the layout of the node must be determined, e.g. while doing draw selection with the mouse or painting the tree. Kind determines which image is needed and Column determines for which column of the node the image is needed. This value can be -1 to indicate there is no column used. The parameter Ghosted can be set to true to blend the image 50% against the tree background and can be used for instance in explorer trees to mark hidden file system objects. Additionally nodes are also drawn with a ghosted icon if the are part of a cut set during a pending cut-to-clipboard operation. In this case changing the ghosted parameter has no effect. Notes Blending nodes can be switched by using toUseBlendImages in TreeOptions.PaintOptions. Class

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top