如何在折线图中拖动折线? [英] How to drag the line in a line chart ?

查看:508
本文介绍了如何在折线图中拖动折线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在折线图中拖动折线?您有一些示例吗?

How to drag the line in a line chart ?Do you have some examples?

推荐答案

您首先必须在某些OnPaint方法中绘制折线.在此过程中,您需要方便使用它的坐标.

拖动意味着按下鼠标按钮,移动鼠标并释放按钮.按下按钮(OnMouseDown),将获得当前光标坐标.检查它们与可拖动线的关系.您将需要在行周围定义一些击中区域,因为强迫您的用户精确击中它会使他们发疯.

如果决定开始拖动,请这样做,然后与鼠标(OnMouseMove)一起移动线的坐标.这样做直到用户释放鼠标.不要忘了时不时地Invalidate()或每个移动的像素Invalidate()来真正看到拖动.

停止拖动OnMouseUp.
You first have to draw the line within some OnPaint method. In the process of doing so, you need to have its co-ordinates handy.

Dragging means to press a mouse button, move the mouse and release the button. On pressing the button (OnMouseDown), you get the current cursor co-ordinates. Check how they relate with your dragable line. You will want to define some hit area around the line because forcing your users to hit it exactly will drive them crazy.

If you decide to let the dragging start, do so and move the line''s co-ordinates along with the mouse (OnMouseMove). Do so until user releases the mouse. Don''t forget to Invalidate() your control every now and then or every moved pixel to actually see the dragging.

Stop dragging OnMouseUp.


<small></small>

[ ] & ;><

[]&><


这篇关于如何在折线图中拖动折线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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