更改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;
  }
  }
posted @ 2010-12-07 15:21  ccczqh  阅读(1415)  评论(0编辑  收藏  举报