newbie-netter
asked on
Color issues withusing CImageList in a Tree control
I've created an 8 bit bmp with some shading for use in a tree control. BMP looks good in the editor but when displayed/used it looks terrible. The color is there but the shading is not
I loaded it like this. I've tried various values besides ILC_COLOR4, including ILC_COLOR but doesn't help
I used it like this
I loaded it like this. I've tried various values besides ILC_COLOR4, including ILC_COLOR but doesn't help
// Load the status bitmaps
g_pStatusImageList = new CImageList();
if (!g_pStatusImageList->Create(IDB_STATUS, 16, 16, ILC_COLOR4))
I used it like this
if (!m_ctlTree.Create(
TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS |
TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS,
CRect(0, 0, 0, 0), this, IDC_TREECTRL)) {
g_pError->Add("Problem creating tree control!");
return 0;
}
m_ctlTree.SetBkColor(GetSysColor(COLOR_WINDOW));
m_ctlTree.SetImageList(g_pStatusImageList, TVSIL_NORMAL);
ASKER
That would have been nice if that was it, but that didn't work. I tried ILC_COLOR32 as well. I added a picture of what it looks like in my editor and in my application
Here's how I'm loading the bitmap, forgot to include that the first time
application.jpg
Here's how I'm loading the bitmap, forgot to include that the first time
m_StatusBitmap.LoadBitmap(IDB_STATUS);
m_pStatusDC->SelectObject( &m_StatusBitmap );
editor.jpgapplication.jpg
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
The example code you added was perfect. Thanks
IMO you should use ILC_COLOR24 instead. Using ILC_COLOR4 means theimage list uses4 bit per pixel thus it can only have 16 different colors. With ILC_COLOR8 there are 8 bit per pixel which address entries of a 256-color palette. Here you can find a little bit more info about this: http://www.ucancode.net/Visual_C_MFC_Samples/Add-bitmap-to-CImageList-VC-Example.htm
Hope that helps,
ZOPPO