请问如何实现Chart控件的鼠标拖动功能?根据论坛的逛逛前辈的图表的移动和缩放这个实例(地址如下:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=66120&skin=0),自己更改代码实现了鼠标滚轮控制图表的放大与缩小。但是鼠标拖动并不知道怎么编写。
鼠标滚轮代码:
内部函数:ImyMouseWheel
Dim sender As system.object = Args(0)
Dim e As System.Windows.Forms.MouseEventArgs = Args(1)
If Vars("bl")
Dim a As object = Forms("产能统计").Controls(sender.name)
If e.Delta > 0 Then
a.AxisY.Max -= 2
a.AxisY.Min += 2
a.AxisX.Max -= 2
a.AxisX.Min += 2
Else
a.AxisY.Max += 2
a.AxisY.Min -= 2
a.AxisX.Max += 2
a.AxisX.Min -= 2
End If
End If'End If
Chart控件的MouseEnter代码
Dim Chart As WinForm.Chart = e.Form.Controls("Chart1")
Dim a As System.Windows.Forms.Control = e.Form.Controls(e.Sender.Name).BaseControl
AddHandler a.MouseWheel, AddressOf MyMouseWheel
Vars("bl") = True
e.Sender.BaseControl.Focus()
Chart控件的MouseLeave代码
Vars("bl") = False
[此贴子已经被作者于2017/3/4 8:46:02编辑过]