如何在 C# 中清除屏幕区域或重绘屏幕
我正在 C#.Net 2.0 中创建用户控件。 我必须在这些控件之间应用拖放图像。 我已经完成了拖放效果。
但问题是我必须在鼠标拖动时显示控件移动。 为此,我借助 ControlDraw.DrawReversibleFrame() 在屏幕上绘制一个矩形
问题是,在使用鼠标移动事件绘制时,矩形会在整个屏幕上绘制,并且由于屏幕上没有重新绘制,因此它存在于屏幕上。
所以请有人告诉我如何清除绘制的图形或如何强制重绘屏幕。
I am creating a User Control in C#.Net 2.0.
I have to apply drag and Drop Images in between these controls.
I have done drag and drop effect.
But the problem is that i have to show the control movement while mouse dragging.
For that i am drawing a rectangle on screen with the help of ControlDraw.DrawReversibleFrame()
Problem is that while drawing with mouse move event Rectangle is drawn over whole screen and because no repaint on screen it exist on screen.
So please can anybody tell me either how to clear drawn graphics or how to force to redraw screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在与之前相同的位置绘制“可反转”框架以将其反转,然后再在新位置绘制下一框架。
伪代码是:
但一般来说,我建议将鼠标光标更改为拖放图标或图像的缩略图会更合适。
You must draw the 'reversable' frame in the same position as previously to reverse it, before drawing the next frame in the new position.
The pseudo-code is:
But in general, I recommend changing the mouse cursor to a drag-drop icon or a thumbnail of the image would be far more appropriate.