倒着删,不会出错
for (int i = this.listBox1.SelectedIndices.Count - 1; i >= 0; i--) { int currentIndex = this.listBox1.SelectedIndices[i]; listBox1.Items.RemoveAt(currentIndex); }
2023-11-11 23:06:10
for (int i = this.listBox1.SelectedIndices.Count - 1; i >= 0; i--) { int currentIndex = this.listBox1.SelectedIndices[i]; listBox1.Items.RemoveAt(currentIndex); }