Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
I have a CTreeView in a splitter window.I want to change the background color at runtime(using a menu).Iam using
GetTreeCtrl().SetBkColor(...)
function to change the background.Now the problem is the background color of icons associated with the tree items is not changing, Though i am changing the bacgroung using,
(GetTreeCtrl().GetImageList(TVIS_NORAMAL)->SetBkColor(...))
The background of images in the icon editor is given as transparent.What will be the problem?Any help?
Comments
Niklas L 23-Feb-11 9:30am    
Check that you have created the image list with the ILC_MASK flag.
oh thank you its working now.But can you please explain what is ILC_MASK, I diid not understand from msdn
Niklas L 1-Mar-11 4:42am    
That flag tells the image list that the image(s) has transparent parts, which icons do. An icon actually consists of two bitmaps. One contains the image you specify, and the other is a monochrome bitmap, a bitmap with only two colors, which tells which pixels should be rendered from the first bitmap and which should not. Where the bitmap is not rendered, there will be a 'hole', and the background will shine through. The icon editor handles this for you, but you will have to let the image list know you want to use it.

1 solution

I think when you give the background color as transparent, the default window color is used, in your case white, I persume. To change it, you can either set the bg color of image to the desired color using SetBkColor on CtlColor().
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900