Hi,
Is it possible to easily disable a the display of a StateImage of one Node or is the only way the use of a custom StateImage-List with one "blank" image?
cheers,
Natorion
Disabling of a StateImage for one Node
Re: Disabling of a StateImage for one Node
Using a custom state image list is one way to achieve this. Another one is to use the CustomDraw event. But a custom state image list should be faster and easier.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Disabling of a StateImage for one Node
After I realized that a blank icon is not really what I want (it is a white space next to the expando) I tried setting the StateImageIndex to Empty:
It is exactly what I want
Code: Select all
treeItem.StateImageIndex = Empty
Re: Disabling of a StateImage for one Node
Oh, yes, I had forgot about this possibility. You can replace Empty with 0, because this is what is happening behind the scenes. For treeviews, state images are one-based, that's why 0 doesn't result in the first state image being displayed.
I tested your code on Windows Vista and it works - with themes as well as without themes. But you should test it on Windows 2000 and XP. If I remember correctly, not all versions of comctl32.dll move the item text to the left if the state image is set to 0.
I tested your code on Windows Vista and it works - with themes as well as without themes. But you should test it on Windows 2000 and XP. If I remember correctly, not all versions of comctl32.dll move the item text to the left if the state image is set to 0.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Disabling of a StateImage for one Node
Tested it with XP without theming and works fine.
Re: Disabling of a StateImage for one Node
I've tested it on Windows 2000 and it works there, too. So I think I'll document it.
Maybe it was Windows 98 or NT 4.0 where it didn't work. But those systems aren't supported anymore.
Maybe it was Windows 98 or NT 4.0 where it didn't work. But those systems aren't supported anymore.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!