本文介绍了如何在ZedGraph中订阅MouseDown事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用鼠标按下事件拖动它来移动曲线。如果在代码中动态生成曲线,我如何订阅此事件(我的意思是我不将其作为控件添加到设计中)。
I写了这个函数
Hi,
I need to move a curve by drag it using mouse down event. How do i subscribe for this event if the curve is generated dynamically in the code (I mean I don't add it in the design as a control).
I wrote this function
Private Sub zgc_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Dim p As PointF
p = e.Location
Dim x, y As Double
If e.Button = Windows.Forms.MouseButtons.Left Then
'..........
End If
End Sub
但是当我点击表格中的任何位置时它都有效,除了图表:(
先谢谢你,
Arwa
but it works when I click in any position in the form EXCEPT the graph :"(
Thank you in advanced,
Arwa
推荐答案
public Form1()
{
InitializeComponent();
...
ZedGraphControl1.MouseDownEvent += ZedGraphControl1_MouseDownEvent;
}
private bool GraphControl_MouseDownEvent(ZedGraphControl sender, MouseEventArgs e)
{
Console.WriteLine("Mouse Down event");
// Your code ...
return true;
}
这篇关于如何在ZedGraph中订阅MouseDown事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!