Search code examples
winapitreeviewwin32gui

Using image instead of default + and - signs in tree view


I am developing a win32 application and I want to use my own images instead of default + and - signs in tree view.

I also found here that I can use images in four cases-

1)An image, such as an open folder, displayed when the item is selected.

2)An image, such as a closed folder, displayed when the item is not selected.

3)An overlay image that is drawn transparently over the selected or nonselected image.

4)A state image, which is an additional image displayed to the left of the selected or nonselected image. You can use state images, such as checked and cleared check boxes, to indicate application-defined item states.

I found some examples like this one(uses state images) but it seems it is not related to my query.

But I can't find how to replace default + and - signs of tree view with my images.

Please help me out of it. Thanks in advance.


Solution

  • The "expansion" buttons are not drawn using an assigned image list; instead they come from the current theme (or in XP/non-themed, are hard-coded glyphs).

    The only way to customize them is to use Custom Draw and draw the tree items yourself.