1.SelectionMode 改成可以多选2.利用KeyDown事件: private void listBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { for (int i = listBox1.SelectedItems.Count - 1; i > -1; i--) { listBox1.Items.Remove(listBox1.SelectedItems[i]); } } }
C#中listbox中选中多项,并删除,布布扣,bubuko.com
时间: 2024-11-07 13:48:47