为什么我无法使用WM_NCPAINT刷新对话框,但与WM_SIZE一起正常工作? [英] Why I am not able to refresh dialog box with WM_NCPAINT, but working fine with WM_SIZE?
问题描述
我在MFC中有对话框应用程序。要刷新对话框上的视图,我们使用WM_NCPAINT,它确实调用OnNCPaint,但有时视图不会刷新。行为并不总是可重复的。 WM_PAINT也发生了同样的行为。
当我们使用SendMessage(WM_SIZE)时,行为不可重现,并按预期工作。
在检查代码之前,我想确定,我应该使用WM_SIZE而不是WM_NCPAINT或WM_PAINT,因为它可以正常工作。
来自 WM_PAINT [ ^ ] MSDN页面:要更新或重绘窗口,请使用 UpdateWindow [ ^ ]和 RedrawWindow [ ^ ]函数。Quote:WM_PAINT消息由系统生成,不应由应用程序发送
I am having dialog box application in MFC. To refresh view on dialog box we are using WM_NCPAINT, it does call OnNCPaint, but sometimes view is not getting refreshed. Behaviour is not always reproducible. Same behaviour is happening with WM_PAINT also.
When we use SendMessage(WM_SIZE), behaviour is not reproducible, and working as expected.
Before checking in the code, I wanted to make sure, should I use WM_SIZE instead of WM_NCPAINT or WM_PAINT, because it is working fine with it.
From the WM_PAINT[^] MSDN page:Quote:The WM_PAINT message is generated by the system and should not be sent by an application
To update or redraw a window use the UpdateWindow[^] and RedrawWindow[^] functions.
这篇关于为什么我无法使用WM_NCPAINT刷新对话框,但与WM_SIZE一起正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!