Mfc Cmetafile和调整大小窗口会擦除所有数据 [英] Mfc Cmetafile and resizing window erases all data

查看:147
本文介绍了Mfc Cmetafile和调整大小窗口会擦除所有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经制作了一个用鼠标绘制线条的软件(Lineto),它是一个基于cview和sdi的mfc程序,但是每当我调整窗口大小或最小化窗口时,窗口中的所有绘图都将被删除
我怎样才能阻止它
可能是一些onpaint事件可以保留图形
plz help

i have made a software to draw lines by mouse(Lineto) it is a mfc program based on cview and a sdi but whenever i resize or minimize my window all the drawing in the window is erased
how can i stop it
may be some onpaint event to retain the drawing
plz help

推荐答案

您需要在OnPaint()处理程序中进行绘制.
You need to do the drawing in the OnPaint() handler.


1.)在绘画消息之外.
2.)您应该存储数据(位图或点列表).
3.)您应该处理擦除和绘画消息.
4.)在画图消息上绘制线条(或其他内容).
5.)绘制为位图非常简单,但仅限于位图本身.
祝你好运.

[edit]
6.)更新窗口-调用InvalidateRect函数.
1.) you should never paint outside a paint message.
2.) you should store your data (bitmap or point-list).
3.) you should handle the erase and the paint messages.
4.) draw your lines (or whatelse) onpaint message.
5.) to paint into a bitmap is very simple but limited to the bitmap size themselves.
Good luck.

[edit]
6.) to update the window - call the InvalidateRect function.


这篇关于Mfc Cmetafile和调整大小窗口会擦除所有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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