Reputation:
This is the relevant part of my code:
case WM_CTLCOLORBTN:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
SetBkMode(HDC(wParam),TRANSPARENT);
return LRESULT(HBRUSH(GetStockObject(NULL_BRUSH)));
It makes the background all the controls transparent, including the edit ones. But when some text is typed, it overwrites on itself and looks messy. How should I reset the visible area and redraw with the current situation? Should I process something inside WM_COMMAND
s EN_CHANGE
or WM_PAINT
or something else?
Here is how it currently looks:
Upvotes: 5
Views: 1096
Reputation:
I realized that once the control is hidden and shown again, it fixes the visibility as intended.
case WM_COMMAND:
if(HIWORD(wParam)==EN_CHANGE)
{
ShowWindow(HWND(lParam),SW_HIDE);
ShowWindow(HWND(lParam),SW_SHOW);
SetFocus(HWND(lParam));
}
break;
case WM_CTLCOLORBTN:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
SetBkMode(HDC(wParam),TRANSPARENT);
return LRESULT(HBRUSH(GetStockObject(NULL_BRUSH)));
Upvotes: 4