仅剩的10分了,谁要?

解决方案 »

  1.   

    如果想获得listview哪个item被checked了,需要遍历整个itemcollection。不过如果你是单选的话,可以结合ItemCheck事件以及私有成员来做处理,这样要简单很多。
      

  2.   

    添加ItemCheck事件代码
    private void listView1_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
    {
    for(int i = 0;i<this.listView1.Items.Count;i++)
    {
    if(i!=e.Index)
    {
    this.listView1.Items[i].Checked = false;
    }
    }
    }