I have created an Owner-Drawn button . I use the WM_CTLCOLORBTN message in order to paint it :
//get the text of the button wchar_t buttonText[20]; int textLength = SendMessage((HWND)lParam,WM_GETTEXT,20,(LPARAM)buttonText); Font FootlightMTLight(L"Footlight MT Light",20,0,false,false,false,L"Black"); SelectObject((HDC)wParam,FootlightMTLight.getWindowHandle()); TextOut((HDC)wParam,30,15,buttonText,textLength); SetTextColor((HDC)wParam, RGB(0,0,0)); SetBkColor((HDC)wParam, RGB(229,255,229)); PatBlt((HDC)wParam,0,0,1,50,BLACKNESS); //x,y,width,height PatBlt((HDC)wParam,269/2-1,0,1,50,BLACKNESS); PatBlt((HDC)wParam,0,49,269/2,1,BLACKNESS); PatBlt((HDC)wParam,0,0,269/2,1,BLACKNESS); static HBRUSH handleToButtonBrush = CreateSolidBrush(RGB(229,255,229)); return (INT_PTR)handleToButtonBrush; "Font" is an object I created (I wrapped HFONT handle and CreateFont function with class etc. getWindowHandle() basically returns HFONT ).
the button renders nicely , yet pressing on it make the text-background turn white. I search the net for a reason and a solution yet I didn't find a concrete one. thanks in advanced!