The easiest way to draw a bitmap in a static control is to let someone else do it.
Code:
case WM_CREATE: // or wherever else the control is created
{
// you can set the control height and width to 0 as it'll resize automatically
HWND hStatic = CreateWindowEx(0, WC_STATIC, TEXT(""), SS_BITMAP | WS_CHILD, ...);
if(hStatic)
{
HBITMAP hBm = // load your hbitmap
SendMessage(hStatic, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBm);
ShowWindow(hStatic, SW_SHOW);
}
}
break;
You could also create a pattern brush with CreatePatternBrush using your HBITMAP and return the brush in reponse to WM_CTLCOLORSTATIC for largely the same effect.