2020年5月22日 星期五

vb.net 在ListView選取在Chart反亮 [Listview item select Chart change color]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
    Dim tmpColor As Color
    Dim tmpIndex As Integer


    Private Sub lvwScreenChart_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvwScreenChart.SelectedIndexChanged
        Try
            If tmpIndex.ToString <> "" Then
                chtScreenChart.Series(tmpChartName).Points.ElementAt(tmpIndex).Color = tmpColor
            End If
        Catch
        End Try
        tmpColor = chtScreenChart.Series(tmpChartName).Points.ElementAt(lvwScreenChart.FocusedItem.Index).Color
        chtScreenChart.Series(tmpChartName).Points.ElementAt(lvwScreenChart.FocusedItem.Index).Color = Color.Gold
        tmpIndex = lvwScreenChart.FocusedItem.Index
    End Sub

沒有留言:

張貼留言