我在我的项目上有一个ContexMenuStrip cms。我正在尝试将此事件添加到我的代码中,但当我右键单击鼠标时,它不会触发。
菜单出现,但未调用该事件。
void cms_Opening(object sender, CancelEventArgs e)
{
// Code...
}我正在尝试处理此事件,以便在满足某些条件时阻止cms打开。
谢谢您抽时间见我。
发布于 2017-02-18 06:36:14
我认为这是相关的代码。
private void MenuTeam_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (dgvMatches.CurrentCell != null && (dgvMatches.CurrentCell.ColumnIndex == 3 || dgvMatches.CurrentCell.ColumnIndex == 6))
{
dgvMatches.CurrentCell.Value = e.ClickedItem.ToString();
dgvMatches.CurrentCell = null;
}
}
private void MenuGolos_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (dgvMatches.CurrentCell != null && (dgvMatches.CurrentCell.ColumnIndex == 4 || dgvMatches.CurrentCell.ColumnIndex == 5))
{
dgvMatches.CurrentCell.Value = e.ClickedItem.ToString();
dgvMatches.CurrentCell = null;
}
}
void MenuGolos_Opening(object sender, CancelEventArgs e)
{
if (dgvMatches.CurrentCell.ColumnIndex != 4 || dgvMatches.CurrentCell.ColumnIndex != 5)
{
MenuGolos.Close();
}
}前两个事件运行良好。第三个没有被触发。
谢谢!
https://stackoverflow.com/questions/42308322
复制相似问题