鼠标悬停在 DataPoint 上时更改 MarkerImage 并在离开 Datapoint 时更改回

Change MarkerImage Upon Mouse Hover On DataPoint and ChangeBack to when Leaving Datapoint

我正在尝试在用户将鼠标悬停在数据点上时更改绘制数据点的标记图像。我在下面显示的代码:

当悬停在数据点上时,数据点一直在更改图像,但没有将其更改回 "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

工作...