Often one needs to load a bitmap and convert the background colour.
This routine will convert all instances of one colour in a bitmap (colfrom) to the desired colour (colto).
Useage:
// res
== bitmap resource identifier
// colfrom == the background colour to convert
// colto == the desired colour.
// to convert to the button colour pass [GetSysColor(COLOR_BTNFACE)]
HBITMAP LoadConvertBitmapCols(int res, COLORREF colfrom, COLORREF colto)
{
BITMAP bm;
// load the bitmap from the resource
HBITMAP hBitmap = LoadBitmap(GetModuleHandle(NULL),
MAKEINTRESOURCE(res));
if (!hBitmap)
return NULL;
// Create memDC and Select the bitmap