Click here to Skip to main content
Licence CPOL
First Posted 6 Jul 2006
Views 49,666
Downloads 1,549
Bookmarked 34 times

How to use 32 bit icons in CTreeCtrl

By | 6 Jul 2006 | Article
This article explains how to use 32 bit icons in a CTreeCtrl.

Introduction

This article explains how to use high colored icons with the common control, CTreeCtrl.

This is done in just four lines of code!!!

Sample image

How To

In your dialog class header, just add two attributes:

CImageList m_imageList; //image list used by the tree
CBitmap m_bitmap; //bitmap witch loads 32bits bitmap

At the end of InitDialog:

// Create a 32bits ImageList
m_imageList.Create (16, 16, ILC_COLOR32 , 1,1);

//Add the bitmap to the ImageList
m_bitmap.LoadBitmap(IDB_BITMAP_HIGHCOLOR);
m_imageList.Add(&m_bitmap, RGB(255,0,255));

//Manage your tree items......
m_tree.SetImageList (&m_imageList, TVSIL_NORMAL);
m_tree.InsertItem("RootItem",0,0,TVI_ROOT);

This is a very easy way to making a good rendering with VC++ 6.0.

That's all !!!!

License

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

About the Author

Le Sourcier

Software Developer
ECT Industries
France France

Member

I am software engineer and I work for the aviation.
 
I'm currently working on many different project and in many different languages
- Visual C++ 6
- C#
- ASP.NET
- C and assembly
 
Have lot of fun

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalwhy same process doesn't work in 2005 PinmemberMember 312032421:32 17 Mar '10  
Rantit is not 32 bit images Pinmembervaadim2:31 25 Jul '09  
GeneralMy vote of 1 Pinmembervaadim2:30 25 Jul '09  
GeneralIf you need transparent images... Pinmemberjohnnyk42771:24 24 Jun '08  
GeneralGood job! PinmemberMember 130445623:31 5 May '08  
QuestionHow to control the ctreectrol's WS_HSCROLL style PinmemberVS_Study22:54 7 Apr '08  
QuestionI want to change size of treeitem image at run time.Is it possible? Pinmembertupipatel23:07 25 Feb '08  
Questiondosen't works. PinmemberRagesh C14:31 5 Nov '06  
AnswerRe: dosen't works. PinmemberLe Sourcier2:38 9 Nov '06  
Questiondosen't works. PinmemberRagesh C14:29 5 Nov '06  
Generalit doesn't worked PinmemberRagesh C14:23 5 Nov '06  
Question32Bit Bitmap - how? PinmemberMichael E. Jones22:43 9 Jul '06  
AnswerRe: 32Bit Bitmap - how? PinmemberLe Sourcier9:40 10 Jul '06  
QuestionRe: 32Bit Bitmap - how? PinmemberMichael E. Jones22:24 10 Jul '06  
AnswerRe: 32Bit Bitmap - how? Pinmembervaadim2:34 25 Jul '09  
JokeRe: 32Bit Bitmap - how? PinmemberMichael E. Jones2:42 25 Jul '09  
GeneralGood reminder ! PinmemberKochise21:48 7 Jul '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 7 Jul 2006
Article Copyright 2006 by Le Sourcier
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid