[转]C#如何在ListView失去焦点的情况下仍然保持Item高亮

 private void listView1_SelectedIndexChanged(object sender, EventArgs e)

        {

            foreach(ListViewItem itm in this.listView1.Items)

            {

                itm.BackColor = SystemColors.Window;

                itm.ForeColor = Color.Black;

            }

            foreach (ListViewItem itm2 in this.listView1.SelectedItems)

            {

                itm2.BackColor = SystemColors.MenuHighlight;

                itm2.ForeColor = Color.White;

            }

        }

 

posted @ 2014-06-17 15:22  Nemo_Li  阅读(1421)  评论(0编辑  收藏  举报