Devexpress网格上下文列表
有一个ContextMenuStrıp和Devexpress GridControl。当我用鼠标右键单击网格标题时,它们会出现上下文菜单条和Devexpress菜单Devexpress网格上下文列表,devexpress,Devexpress,有一个ContextMenuStrıp和Devexpress GridControl。当我用鼠标右键单击网格标题时,它们会出现上下文菜单条和Devexpress菜单 仅当我右键单击网格标题时,我只想显示Devexpress菜单(而不是contextmenu)。当您处理鼠标向上移动事件时,您需要验证单击是否在一行或一个单元格中,如下所示: GridHitInfo hitInfo = view.CalcHitInfo(e.Location); // Verify that the click wa
仅当我右键单击网格标题时,我只想显示Devexpress菜单(而不是contextmenu)。当您处理鼠标向上移动事件时,您需要验证单击是否在一行或一个单元格中,如下所示:
GridHitInfo hitInfo = view.CalcHitInfo(e.Location);
// Verify that the click was in a cell of a row, if not, don't do anything
if (!hitInfo.InRowCell)
return;
首先,我想说声谢谢。我用下面的代码解决了我的问题
private void gridView1_MouseUp(object sender, MouseEventArgs e)
{
GridView view = (GridView)sender;
GridHitInfo hitInfo = view.CalcHitInfo(e.Location);
if (!hitInfo.InRowCell)
contextMenuStrip1.Visible = false;
else
contextMenuStrip1.Visible = true;
}
很高兴你解决了这个问题(我建议的方法与我的答案相同),但我有一个问题,为什么首先显示上下文菜单,然后使其不可见?我认为,如果单击位于网格行的外侧,则根本不应该显示它。