解决你第二个问题:给你一个例子 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
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