private
void
addButton_Click(object sender, EventArgs e)
{
string item1Str = coutNumber.ToString();
string item2Str = coutNumber.ToString();
this
.listView1.Items.Add(
new
ListViewItem(
new
string[] { item1Str, item2Str }));
coutNumber++;
}
private
void
delButton_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in listView1.Items)
{
if
(listView1.SelectedItems.Contains(item))
{
int
indexDel = listView1.Items.IndexOf(listView1.FocusedItem);
if
(listView1.SelectedItems.Count !=
0
)
{
listView1.Items.RemoveAt(indexDel);
}
}
}
}
请发表评论