Link to home
Start Free TrialLog in
Avatar of shvetsov
shvetsov

asked on

Icons in TreeView

My TreView shows icons with black background.
I made background transparent, it looks transparent in Windows Explorer and I want it to be transparent in my TreeView. This is the code:

  g_himl = ImageList_Create(16, 16, ILC_COLOR4, 1, 1);
  hicon = LoadIcon(g_hInst, MAKEINTRESOURCE(ICO_MyComp));
  iMyComp = ImageList_AddIcon(g_himl, hicon);
  DeleteObject(hicon);
  TreeView_SetImageList(g_hwndTree, g_himl, VSIL_NORMAL);
Avatar of Roshan Davis
Roshan Davis
Flag of United States of America image

U have to specify ILC_COLOR'X' depending on the no. of colors used in the icon.

If 256 color icon is used, u have to specify ILC_COLOR8

if 16 color icon - ILC_COLOR4 can use


One mistake is also in the code - that compliling error

"TreeView_SetImageList(g_hwndTree, g_himl, VSIL_NORMAL)"

correct is
TreeView_SetImageList(g_hwndTree, g_himl, TVSIL_NORMAL)

GOOD LUCK


ASKER CERTIFIED SOLUTION
Avatar of Paul Maker
Paul Maker
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial