bitmaps for listview and treeview

I am facing trouble in settting a proper color
for the  bitmaps(icons) of listview and treeview. when i open the
bitmap in paint brush everything is ok. but when i
import the bitmap in the resource editor and compile it, during runtime - the light yellow color appears white.
I tried copy paste from bitmap in paint brush to resource editor,
however it does not work. To top it all when i change the color
of the bitmap in the resource editor, i am unable to save
new colors of bitmaps.
all suggestions are welcomed
Who is Participating?
jianliuerConnect With a Mentor Commented:
Can you tell me the type of the imagelist of your ListView and TreeView?(the nFlags parameter you specified in your Create() function of the CImageList object)

Send some pieces of codes to this address<>,I will try my best to help you.
MFCAnswerAuthor Commented:
Edited text of question.
Vinayak KumbarSr Program ManagerCommented:

Go to the properties of the bitmap and change the color to 256 and try it.

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

MFCAnswerAuthor Commented:
Thanks VinExpert, however it still does not work
You should not use bitmap with true-color in resource editor because the resource editor can only handle 256 colors bitmap.
Try the function LoadImage() which can read .bmp file.
MFCAnswerAuthor Commented:
thanks jinliuer.
When i use LoadImage, the icons are appearing light green instead of light
yellow. Do i have to make changes to palette ??
 I am increasing points to 100.
MFCAnswerAuthor Commented:
Hi  jianliuer :
Thanks for the response. I need help urgently.  I cannot send u the code as it is too big a code. i shall try to create a dummy project and send u the code. Meanwhile, this is what i am doing to display icons in the tree view.

CBitmap             _bitmap;
// Initialze the image list for out tree view
m_pilTreeIcons = new CImageList();
m_pilTreeIcons->Create(20, 20, ILC_MASK, 8, 4);
HBITMAP phBitmap = NULL;
HPALETTE *phPalette = NULL;
phBitmap = (HBITMAP)::LoadImage(AfxGetResourceHandle(),lpszResourceName,IMAGE_BITMAP, 0, 0,LR_CREATEDIBSECTION);
if( phBitmap == NULL )
AfxMessageBox("unable to load bitmap");
 CBitmap *temp, temp1 ;
  temp = temp1.FromHandle(phBitmap );
m_pilTreeIcons->Add(&_bitmap,  (COLORREF)0xFFFFFF);

GetTreeCtrl SetImageList(m_pilTreeIcons, TVSIL_NORMAL);      
PopulateTree(); // to list tree items
MFCAnswerAuthor Commented:
Hi  jianliuer :
Don't bother to answer . I have solved the problem. I am going to give u points for the effort u have put in to answer my question. thanks a lot
All Courses

From novice to tech pro — start learning today.