更改listview的选中行的背景色
private void listView_Validated(object sender, EventArgs e)
{
if (listView.FocusedItem != null)
{
listView.FocusedItem.BackColor = SystemColors.Highlight;
listView.FocusedItem.ForeColor = Color.White;
}
}
private void listView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
e.Item.ForeColor = Color.Black;
e.Item.BackColor = SystemColors.Window;
if (listView.FocusedItem != null)
{
listView.FocusedItem.Selected = true;
}
}
{
if (listView.FocusedItem != null)
{
listView.FocusedItem.BackColor = SystemColors.Highlight;
listView.FocusedItem.ForeColor = Color.White;
}
}
private void listView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
e.Item.ForeColor = Color.Black;
e.Item.BackColor = SystemColors.Window;
if (listView.FocusedItem != null)
{
listView.FocusedItem.Selected = true;
}
}