private void tbtDel_Click(object sender, EventArgs e) { if (listTable.SelectedItems.Count == 0) { MessageBox.Show("请选择删除项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("是否确认删除?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } for (int i = listTable.SelectedItems.Count - 1; i >= 0; i--) { ListViewItem item = listTable.SelectedItems[i]; CTable tb = (CTable)item.Tag; if (tb.IsSystem) { string sMsg = string.Format("系统表 {0} 不能删除!", tb.Name); MessageBox.Show(sMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); continue; } if (Program.Ctx.TableMgr.Delete(tb, true)) { CTable.DeleteDataTable(tb); } listTable.Items.Remove(item); } }