当用户在数据点上悬停时,我试图更改绘制数据点的标记图像。我的代码如下所示:
数据点在悬停在其上时一直在改变图像,但是没有将其改回“Red.png”?
任何人都可以找出为什么没有发生这种情况?
谢谢。
Private Sub Chart1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Chart1.MouseMove
Dim result As HitTestResult = Chart1.HitTest(e.X, e.Y)
If result.ChartElementType = ChartElementType.DataPoint Then
Chart1.Series(0).Points(result.PointIndex).MarkerImage = "Green.png"
ElseIf result.ChartElementType = ChartElementType.PlottingArea Then
Chart1.Series(0).MarkerImage = "Red.png"
End If
End Sub
我想通了:改变这些线条
ElseIf result.ChartElementType = ChartElementType.PlottingArea Then
Chart1.Series(0).MarkerImage = "Red.png"
至
ElseIf result.ChartElementType = ChartElementType.PlottingArea Then
For i = 0 To Chart1.Series(0).Points.Count - 1
Chart1.Series(0).Points(i).MarkerImage = "Red.png"
Next
工作...