MFC中的绘画程序 [英] A Paint Program in MFC

查看:75
本文介绍了MFC中的绘画程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当鼠标移动时如何绘制绘制的线,同时InvalidateRect()每次重新绘制窗口时,如何保留绘制的线. PLZ 请尽快帮助我.

How to retain the drawn line while drawing another,while mouse move,as InvalidateRect() is repainting the window every time. PLZ Please Help me as soon as possible.

推荐答案

请参阅
See the Scribble MFC sample[^].
cheers,
AR


您可以存储前几行的起点和终点,并重新绘制前几行和新行.
You can store the start and end points of previous lines and re-draw previous and new lines.


Invalidate()仅应调用需要重新绘制特定窗口时.也许您在不应该打电话的时候就打电话给它.通常,只有当窗口确定您的绘图上下文区域发生了更改时,才会调用绘制例程,方法是将一个窗口放置在您的窗口上方,然后将其删除,或者调整大小,但是如果您正在绘制图层或具有影响外观的控件,那么就是您要使某些部分无效.
Invalidate() should only be called when the particular window needs to be redrawn. Maybe you''re calling it when you shouldn''t be called. In general, the paint routines will only be called when windows determines there''s been a change to your drawing context area, either by a window being placed on top of yours then removed, or resizing, but if you''re drawing layers or have controls that affect appearance, then that''s when you''d invalidate certain portions.


这篇关于MFC中的绘画程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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