如何在MFC中刷新对话框 [英] How to refresh the dialog in MFC

查看:206
本文介绍了如何在MFC中刷新对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从CDialog(模态)派生的对话框。现在当我按下窗口+ D以最小化所有窗口时,当我恢复对话框时,对它的所有控制都会消失,只有当我移动时才会重新出现对话窗口。

为什么会发生这种情况以及如何解决这个问题。



我尝试了什么:



我相信RedrawWindow窗口可以做到这一点,但不知道在哪里实现它。通过窗口+ D单击恢复窗口时会遇到哪个事件。

I have a dialog which is derived from CDialog (Modal ) .Now when I press window+D to minimize all the windows and again when I restore the dialog then all the control over it get disapper which only reappear when I move the dialog window.
Why it is happening so and how to fix this .

What I have tried:

I believe RedrawWindow window will do the trick but don't know where to implement this. Which event is going to get hit upon restoring the window through window+D click.

推荐答案

在最小化后恢复时,OnSize [ ^ ]时, nType 设置为SIZE_RESTORED。



通常情况下,窗口会自动重绘。如果您已经在使用OnSize,请检查以确保您正在调用基类的函数。
On restoring after minimise, OnSize[^] is called with nType set to SIZE_RESTORED.

Normally the window would redraw itself automatically though. If you're already using OnSize, check to make sure you're calling the base class' function.


通过拦截WM_NCPAINT并调用RedrawWindow()以及基类处理程序I可以刷新对话框。

谢谢大家。
By intercepting the WM_NCPAINT and calling the RedrawWindow() along with the base class handler I could refresh the dialog .
Thanks all .


这篇关于如何在MFC中刷新对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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