Disabling of a StateImage for one Node

The place for threads about version 2.x of TimoSoft ExplorerTreeView.
Post Reply
Natorion
Lieutenant
Posts: 14
Joined: 12 Jan 2009, 10:35

Disabling of a StateImage for one Node

Post by Natorion »

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
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: Disabling of a StateImage for one Node

Post by TiKu »

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!
Natorion
Lieutenant
Posts: 14
Joined: 12 Jan 2009, 10:35

Re: Disabling of a StateImage for one Node

Post by Natorion »

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:

Code: Select all

treeItem.StateImageIndex = Empty
It is exactly what I want ;)
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: Disabling of a StateImage for one Node

Post by TiKu »

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.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Natorion
Lieutenant
Posts: 14
Joined: 12 Jan 2009, 10:35

Re: Disabling of a StateImage for one Node

Post by Natorion »

Tested it with XP without theming and works fine.
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: Disabling of a StateImage for one Node

Post by TiKu »

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.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Post Reply