C# 更快地绘制矢量图形
在我的应用程序中,我想使用 Windows 创建图形方法绘制多边形,然后通过允许用户选择多边形的点并允许重新定位它们来编辑多边形。
我使用 moue move 事件来获取该点的新位置,以获取正在移动的点的新坐标,并使用 Paint 事件重新绘制多边形。应用程序正在运行,但是当移动一个点时,移动不平滑。这可能是由于在移动点时触发了大量的鼠标移动和绘制事件。
我不知道鼠标移动或绘画事件是否会影响性能。
谁能就如何改进这个问题提出建议?
In my application I want to draw polygons using Windows Create Graphics method and later edit the polygon by allowing the user to select the points of the polygon and allowing to re-position them.
I use moue move event to get the new position of the point to get the new coordinates of the point being moved and use Paint event to re-draw the polygon. The application is working but when a point is moved the movement is not smooth. This is probably due to large numbe of mouse move and paint events firing while moving the point.
I dont know weather the mouse move or the paint event the performance hindrance.
Can anyone make a suggestion as to how to improve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据我的 Win32 经验(不是 .NET),最快的矢量图形是图元文件。我不知道 C# System.Drawing.Imaging.Metafile 是否与 Win32 一样快。可能与您的视频 2D 硬件一样快。
From my Win32 expirience (not a .NET) the fastest vector graphic is Metafile. I dont know if the C# System.Drawing.Imaging.Metafile is as fast as Win32 one. Could be as fast as your video 2D hardware.
看看c#中的双缓冲。这可以大大加快速度。
look at double buffering in c#. this can speed thing up greatly.