最小化对话框后,工程图丢失. [英] The Drawing is missing after minimizing Dialog.

查看:83
本文介绍了最小化对话框后,工程图丢失.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的MFC应用程序中有问题.当我在我的
中画东西时 最小化对话框后重新打开对话框时缺少的对话框.

谢谢
Mithun Nair

Hi,
I have a problem in my MFC application. When I draw Something in My
Dialog that are missing when dialog reopened after a minimizing of the dialog.

Thanks
Mithun Nair

推荐答案

这是一个非常典型的错误.图形的呈现应在WM_PAINT Windows消息的处理程序中完成.通过更改渲染中使用的图形数据,然后调用Invalidate方法之一,可以实现图形渲染中的更改.这将触发Windows的WM_PAINТ消息,并通过调用处理程序来更新请求的区域或矩形.

绘制方式以易变的方式呈现图形:在下一次失效后它会消失.

在您描述的情况下,当窗口最小化,隐藏或仅被其上的其他某个窗口部分掩盖时,就会发生无效化.当窗口的某些区域再次出现在屏幕上时,它无效,WМ_PAINT消息再次发送到您的应用程序(可选,并且通常在WM_ERASEBKGND消息之后),但是不会再现您的渲染,因此其效果消失了.

—SA
This is a very typical mistake. The rendering of graphics should be done in the handler of the WM_PAINT Windows message. The changes in graphic rendering are achieved by changing of the graphical data uses in rendering and then calling one of the Invalidate methods. This triggers WM_PAINТ message by Windows and updated the requested region or rectangle by calling your handler.

The way you draw renders graphics in volatile manner: it disappears after next invalidation.

In the case you describe, invalidation is happen when a windows gets minimized, hidden or simply partially masked by some other window on top of it. When some region of your windows appears on screen again, it is invalidated, WМ_PAINT message is dispatched to your application again (optionally and usually after WM_ERASEBKGND message), but your rendering is not reproduced, so its effect disappears.

—SA


这篇关于最小化对话框后,工程图丢失.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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