I have an issue with VirtualTreeView component on Windows 7. I added a TVirtualStringTree and used OnGetImageIndex event to assign ImageIndex which is always in debugger non-zero value.
VirtualStringTree uses a TImageList with 16x16 icons as Images property.
On Windows XP it works properly and on Windows 7 it overlaps icon with index 0 from TImageList on top of a normal icon. I am running the same program on Windows 7 as on XP so the code is identical, but the drawing is different.
This image illustrates the issue:
The gray triangle icon has index of 0 and folder icon has index of 5.
Is this a bug in VirtualStringTree? Can I somehow avoid this?
I am using the latest VirtualTreeView version from repository.
In your OnGetImageIndex
event handler, pay attention to the Kind: TVTImageKind
parameter. Assign ImageIndex
as required (typically, this is only for ikNormal
and ikSelected
values), otherwise assign -1.
For example, assigning a valid image index when Kind
has the value of ikOverlay
will cause an overlay image to be drawn over the normal image. (Which may be related to your problem.)