tags:

views:

395

answers:

2

How do I load a true color image into a CImageList?

Right now I have

mImageList.Create(IDB_IMGLIST_BGTASK, 16, 1, RGB(255,0,255));

Where IDB_IMGLIST_BGTASK is a 64x16 True color image. The ClistCtrl I am using it in shows 16 bpp color. I don't see a Create overload that allows me to specify both the bpp and the resource to load from.

+2  A: 

Needs 4 lines of code, but this works:

CBitmap bm;
bm.LoadBitmap(IDB_IMGLIST_BGTASK);
mImageList.Create(16, 16, ILC_COLOR32 | ILC_MASK, 4, 4);
mImageList.Add(&bm, RGB(255,0,255));
Nick
Why am I always too slow or everyone else so amazingly fast? :-)
fhe
+1  A: 
CImageList::Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow)

allows to specify different flags with the nFlags parameter. You can try to use something like ILC_COLOR32 | ILC_MASK.

fhe