为什么我无法使用WM_NCPAINT刷新对话框,但与WM_SIZE一起正常工作? [英] Why I am not able to refresh dialog box with WM_NCPAINT, but working fine with WM_SIZE?

查看:79
本文介绍了为什么我无法使用WM_NCPAINT刷新对话框,但与WM_SIZE一起正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MFC中有对话框应用程序。要刷新对话框上的视图,我们使用WM_NCPAINT,它确实调用OnNCPaint,但有时视图不会刷新。行为并不总是可重复的。 WM_PAINT也发生了同样的行为。



当我们使用SendMessage(WM_SIZE)时,行为不可重现,并按预期工作。



在检查代码之前,我想确定,我应该使用WM_SIZE而不是WM_NCPAINT或WM_PAINT,因为它可以正常工作。

解决方案

来自 WM_PAINT [ ^ ] MSDN页面:

Quote:

WM_PAINT消息由系统生成,不应由应用程序发送

要更新或重绘窗口,请使用 UpdateWindow [ ^ ]和 RedrawWindow [ ^ ]函数。


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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆