TAdvTreeView: black background in node icon when assigning bitmap


'Im sure I'm missing something but when I try to replace the ExpandNodeIconLarge or one of the other icons in the TreeView they are

a) always drawn as black conent on black background (black squares), when enabling AdaptToStyle
b) drawn with black background when disabling AdaptToStyle

I'm trying to get the image out of a TAdvSVGImageCollection the following way:

fTV.NodesAppearance.ExpandNodeIconLarge :=
(0, 42, 42));

How can I get the image but with transparent background?

Thank you


Please use SVG files instead, which are drawn fully transparent. If you extract icons from the image collection, they are rendered as bitmaps, which always have a background color.

Ok, I've found a small bug in AdvCustomTreeView

Line 9406 should not be
FExpandNodeIcon.OnChange := BitmapChanged;
FCollapseNodeIcon.OnChange := BitmapChanged;

I managed to get the SVG via


but how do I scale the SVG?
Do I have to use a virtualImageCollection?

Thanks for notifying. We fixed it here.

1 Like

You can set the node expand icon width & height via NodesAppearance.ExpandWidth & NodesAppearance.ExpandHeight

Hm, not in my version.
In deed the space for the icon is influenced by NodesAppearance.ExpandWidth & NodesAppearance.ExpandHeight, but not the icon itsself.

If the place where the icons are drawn is TAdvTreeView.DrawNode then the size seems to be taken from the image itsself:

bmpa.SetSize(bmp.Width, bmp.Height); (Line 955)

What you can do, is draw the node icon yourself, with aspect ratio instead. The OnBeforeDrawNodeExpand can help you with that.

Well, yes, but that's too much work for an relatively small effekt.