private System.Windows.Forms.MenuItem createMenuByType(XtraContextMenuType menuType) { Type enumType = typeof(XtraContextMenuType); string str = MB.Util.MyCustomAttributeLib.Instance.GetFieldDesc(enumType, menuType.ToString(), false); str = MB.BaseFrame.CLL.Convert(str); XtraMenu menu = new XtraMenu(str, new System.EventHandler(menuItemClick), menuType); _GridMenu.MenuItems.Add(menu); if (menuType == XtraContextMenuType.ColumnsAllowSort) { menu.Checked = true; } return(menu); }
private void menuItemClick(object sender, System.EventArgs e) { try { XtraMenu menu = sender as XtraMenu; if (menu == null) { return; } TreeListExMenuEventArg arg = new TreeListExMenuEventArg(menu.MenuType); arg.Column = _TreList.FocusedColumn; _TreList.RaiseBeforeContextMenuClick(arg); } catch (Exception ex) { MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex); } }