右键显示菜单项需要处理的事件:

privatevoidgridView3_ShowGridMenu(objectsender,DevExpress.XtraGrid.Views.Grid.GridMenuEventArgse){ if(e.MenuType==DevExpress.XtraGrid.Views.Grid.GridMenuType.Row) { GenMenu(e.Menu,gridView3.Name); }}

生成菜单项:

voidGenMenu(GridViewMenugvMenu){ gvMenu.Items.Add(new DXMenuItem("Copy", new EventHandler(DoCopy),Resources.CopyHS)); gvMenu.Items.Add(new DXMenuItem("Paste",new EventHandler(DoPaste),Resources.PasteHS)); gvMenu.Items.Add(new DXMenuItem("Delete",new EventHandler(DoDel),Resources.DeleteHS));}

Resources.CopyHS:资源中的Copy图标,

Resources.PasteHS:资源中的Paste图标,

Resources.DeleteHS:资源中的Delete图标,

菜单项的处理事件:

privatevoidDoCopy(objectsender,EventArgsargs){//Copysomething}privatevoidDoPaste(objectsender,EventArgsargs){//Pastesomething}privatevoidDoDelete(objectsender,EventArgsargs){//Deletesomething}