Solved

About CImageList

Posted on 2002-07-29
2
222 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
Comment Utility
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
Comment Utility
Thanks qurly...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

6 Experts available now in Live!

Get 1:1 Help Now