Solved

About CImageList

Posted on 2002-07-29
2
224 Views
Last Modified: 2013-11-20
hi friends
          i am using CImagelist in my application ,i am using this images in front of a tree items (create this imagelist in OnInitDialog() of a dialog which contains a tree)
& i want to change the color of a image(which is in the list) & in front of a particular treeitem according to my event...
   i am using SetItemImage(..) ,but it works only when i click on that item only...
how it is possible..(i want detail information..that how to create CImageList ..& how to perform this required task..)

bye
srinitin
0
Comment
Question by:srinitin
2 Comments
 
LVL 1

Accepted Solution

by:
gurly earned 50 total points
ID: 7185142
Creating an image-list (based on icons):
     // creating the image list
     m_oImgList.Create(     16, // item width
                              16, // item height
                              TRUE, // flags
                              1, // initial items in the image list
                              1); // grow by
     // inserting items to the image list
     CWinApp* pApp = AfxGetApp();
     int nIcon1 = m_oImgList.Add(pApp->LoadIcon(IDI_ICON1));
     int nIcon2 = m_oImgList.Add(pApp->LoadIcon(IDI_ICON2));


To change the item image:
(Let's say you want to change the image to IDI_ICON2)
m_oTree.SetItemImage(hItem, nIcon2, nIcon2);

try invalidating the tree:
m_oTree.Invalidate();
0
 

Author Comment

by:srinitin
ID: 7187467
Thanks qurly...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 85
Add content to output file 4 62
Detect CR LF to each line 12 152
FizzBuzz challenge 9 76
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short film showing how OnPage and Connectwise integration works.

948 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

21 Experts available now in Live!

Get 1:1 Help Now