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
LVL 1
MFCAnswerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MFCAnswerAuthor Commented:
Edited text of question.
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

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

VinExpert
0
MFCAnswerAuthor Commented:
Thanks VinExpert, however it still does not work
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

jianliuerCommented:
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.
0
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.
0
jianliuerCommented:
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<jianliuer@sina.com>,I will try my best to help you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.


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

GetTreeCtrl SetImageList(m_pilTreeIcons, TVSIL_NORMAL);      
PopulateTree(); // to list tree items
}
0
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.