C#中listbox中选中多项,并删除

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]);
}
}
}
原文地址:https://www.cnblogs.com/xieon1986/p/3841380.html