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;



            }



        }

 

你可能感兴趣的:(ListView)