Datagridview加右键菜单功能
private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
for (int i = 0; i < contextMenuStrip1.Items.Count; i++)
{
if (contextMenuStrip1.Items[i].Selected)
{
if (contextMenuStrip1.Items[i].Text.Trim() == "新增")
{
MessageBox.Show("执行新增操作");
}
else if (contextMenuStrip1.Items[i].Text.Trim() == "删除")
{
MessageBox.Show("执行删除操作");
}
}
}
}
Datagridview加右键菜单功能
最新推荐文章于 2023-08-09 14:59:02 发布