capture the WM_CTLCOLOREDIT message and get the handle to that edit box.
case WM_CTLCOLOREDIT:
//Get Handle to that control first
if((HWND)lParam==GetDlgItem(hwnd,IDC_TEXTBOX)){
HDC hDC = (HDC)wParam;
COLORREF color = RGB(192,0,0); // red color
SetTextColor(hDC, color);
//Optionally, set background color
//SetBkColor(hDC, RGB(255,255,0)); /* yellow */
}
return GetStockObject(WHITE_BRUSH);
break;
For a static control use WM_CTLCOLORSTATIC message:
Example:
HDC hdcStatic = (HDC)wParam;
SetTextColor(hdcStatic, RGB(255, 0, 0)); //red color
SetBkMode(hdcStatic,TRANSPARENT);
return GetStockObject(NULL_BRUSH);
No comments:
Post a Comment