13,874
社区成员
发帖
与我相关
我的任务
分享因为windows就是这么处理的: https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-erasebkgnd
The DefWindowProc function erases the background by using the class background brush specified by the hbrBackground member of the WNDCLASS structure. If hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background.
An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background; this indicates that no further erasing is required. If the application returns zero, the window will remain marked for erasing. (Typically, this indicates that the fErase member of the PAINTSTRUCT structure will be TRUE.)
返回0,只是继续标记背景需要擦除,但是DefWindowProc不进行默认擦除(之后再发送WM_ERASEBKGND消息时还会包括这一区域)