我处理 WM_NCCALCSIZE 消息,并尝试手动设置目标窗口客户端矩形。
case WM_NCCALCSIZE:
{
RECT *rect = (LPRECT)lParam;
if (wParam == TRUE)
{
////缩小客户区的范围
//RECT *rect = (LPRECT)lParam;
//rect->left += 8;
//rect->right -= 8;
//rect->top += 30;
//rect->bottom = 8;
InflateRect(rect, -50, -50);
RECT dstRect = *(LPRECT)lParam;
RECT srcRect = rect[1];
rect[1] = dstRect;
rect[2] = srcRect;
//DefWindowProc(hWnd, message, wParam, lParam);
return 0;
//return WVR_REDRAW;
}
else
{
DWORD lRet = DefWindowProc(hWnd, message, wParam, lParam);
return lRet;
}
但结果很糟糕, 当我调整窗口大小时,使用 DrawText 绘制的文本不会被完全擦除。
如何完全擦除背景?