2个回答
展开全部
在VB中如何获得tchart控件中图象的坐标值方法:
备注:Series(0)为相对误差系列,Series(1)为实测流量系列,Series(2)为雨量系列
'显示图2的坐标
Private Sub TChart2_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
Dim somebar As Single ‘定义变量
With TChart2.Series(0)
somebar = .Clicked(X, Y) ’获得鼠标点击的地方的坐标
If somebar <> -1 Then ‘判断,没有什么具体意义
Label27.ForeColor = .PointColor(somebar) ’标签中字体颜色和点击的系列相同
Label27.Caption = Format(.XValues.Value(somebar) + 3, "0000") + "相对误差:" + Format(.YValues.Value(somebar), "0.0") + " %" ‘显示坐标
End If
End With
With TChart2.Series(1)
somebar = .Clicked(X, Y)
If somebar <> -1 Then
Label27.ForeColor = .PointColor(somebar)
Label27.Caption = Format(.XValues.Value(somebar) + 3, "0000") + "计算流量:" + Format(.YValues.Value(somebar), "0.0") + " m3/s"
End If
End With
With TChart2.Series(2)
somebar = .Clicked(X, Y)
If somebar <> -1 Then
Label27.ForeColor = .PointColor(somebar)
Label27.Caption = Format(.XValues.Value(somebar) + 3, "0000") + "雨量:" + Format(.YValues.Value(somebar), "0.0") + " mm"
End If
End With
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询