关于listview右键菜单显示问题。急急急急。。。。

2024-12-16 14:33:56
推荐回答(2个)
回答1:

private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
string strName = e.ClickedItem.Name;
if ("delMenuItem2".Equals(strName))
{
this.listView1.Items.Remove(listView1.Items[0]);
}

}

回答2:

private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in listView1.SelectedItems)
{
listView1.Items.Remove(item);
}
}
here you are