Mar 152012

A friend of mine passed on this interesting use of an CImageList to make color in a bitmap transparent. It’s really simple and handy for creating bitmaps as backgrounds on dialogs or controls.

BITMAP bminfo;
CBitmap bm;
CImageList imageList;
imageList.Create(bminfo.bmWidth, bminfo.bmHeight, ILC_COLOR24 | ILC_MASK, 1, 1);
imageList.Add(&bm, RGB(255, 255, 255));

Note: the second argument of the .Add() function is the color you want to make transparent.

Leave a Reply