GridView-右键菜单(Menu)
右键显示菜单项需要处理的事件:
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}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。