MFC:如何删除刚刚绘制的矩形
有人可以告诉我如何删除刚刚在图像上绘制的矩形吗?
在应用程序中,我在文档(MDI 应用程序)上显示了图像。用户可以选择图像的一部分。我实现此功能的方式是让用户使用 CRectTrackerColor(派生自 CRectTracker)对象开始选择。选择工作正常:用户可以使用鼠标选择一个矩形。显示橡皮筋矩形作为反馈。用户释放鼠标左键后,矩形将根据我的笔颜色进行着色。然后我会显示一个“确定/取消”对话框。取消后,我希望矩形消失。我应该怎样做呢?
谢谢。
Could somebody tell me how to erase a rectangle that has just been drawn on an image?
In the application, I have an image displayed on a document (MDI application). The user can select a portion of the image. I implemented this feature as letting the user start the selection with a CRectTrackerColor (derived from CRectTracker) object. The selection works fine: a user is able select a rectangle using the mouse. A rubber band rectangle is shown as a feedback. After the user releases the left mouse, the rectangle is colored based on my pen color. Then I present a dialog for OK/Cancel. Upon Cancel, I would like the rectangle to disappear. How should I go about doing that?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需使该矩形无效,这样它就会正常重绘。
Just invalidate that rectangle so it'll get redrawn normally.