Изменение цвета строки в ListView - Visual Basic .NET
Формулировка задачи:
Прошу подсказать, как сделать так, что при определенном слове в ячейке изменялся цвет всей строки?
Решение задачи: «Изменение цвета строки в ListView»
textual
Листинг программы
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click fillListView() Dim cl As Color = Color.Aqua For Each itm As ListViewItem In ListView1.Items itm.UseItemStyleForSubItems = True If itm.SubItems(1).Text = "235" Then itm.BackColor = cl End If Next End Sub Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click fillListView() Dim cl As Color = Color.Aqua Dim scl As Color = Color.LightGreen For Each itm As ListViewItem In ListView1.Items If itm.SubItems(1).Text = "235" Then itm.UseItemStyleForSubItems = False For Each sitm As ListViewSubItem In itm.SubItems sitm.BackColor = scl Next itm.BackColor = cl End If Next End Sub
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д