Solved

Icons in TreeView

Posted on 2002-04-10
2
665 Views
Last Modified: 2013-12-03
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);
0
Comment
Question by:shvetsov
2 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 6933036
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


0
 
LVL 10

Accepted Solution

by:
makerp earned 100 total points
ID: 6941297
image_list.Create(13,13,ILC_COLOR4|ILC_MASK,3,1);
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now