gridControl gridView响应右键菜单
增加一个PopupMenu并编辑相关菜单项,然后在gridView的MouseUp事件里写如下代码:
private void gridView1_MouseUp(object sender, MouseEventArgs e) { //鼠标右键响应 GridView detailGrid = (sender as GridView); GridHitInfo hitInfo = (detailGrid.CalcHitInfo((e as MouseEventArgs).Location)); // DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.gridView_ResumeCollection.CalcHitInfo(e.Location); if (hitInfo.InRow && e.Button == MouseButtons.Right) { popupMenu1.ShowPopup(Control.MousePosition); } }