private void gvRolls_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) { if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Row) { if (e.HitInfo.InRow && e.HitInfo.RowInfo != null) { DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)sender; dynamic obj = null; object itm = gv.GetRow(gv.FocusedRowHandle); DevExpress.XtraGrid.Menu.GridViewMenu menu = e.Menu as DevExpress.XtraGrid.Menu.GridViewMenu; menu.Items.Clear(); DevExpress.Utils.Menu.DXMenuItem mgr = new DevExpress.Utils.Menu.DXMenuItem(); mgr.Caption = $"Delete"; mgr.Click += delegate(object o, EventArgs args) { gv.DeleteSelectedRows(); ReCalcs(); }; menu.Items.Add(mgr); } } }
public CanChooseDataGridView() : base() { this.AutoMode = true; this.AllowChooseGroup = true; this.AutoRefresh = true; GroupDetailConfigButton = new DevExpress.Utils.Menu.DXMenuItem("GroupDetailConfig", GroupDetailConfigButtonClicked); this.InitChooseRelationControls(); this.DataSourceChanged -= DataSourceChangeEventMethod; this.DataSourceChanged += DataSourceChangeEventMethod; this.CustomDrawGroupRow -= DrawChooseGroupRowEventMethod; this.CustomDrawGroupRow += DrawChooseGroupRowEventMethod; this.CustomSummaryCalculate -= ChooseSummaryCalculate; this.CustomSummaryCalculate += ChooseSummaryCalculate; this.Click -= ChooseViewClickEventMethod; this.Click += ChooseViewClickEventMethod; this.CustomDrawColumnHeader -= CustomDrawChooseColumnHeaderEventMethod; this.CustomDrawColumnHeader += CustomDrawChooseColumnHeaderEventMethod; this.MouseDown -= MouseDownEventMethod; this.MouseDown += MouseDownEventMethod; this.PopupMenuShowing -= CanChooseDataGridView_PopupMenuShowing; this.PopupMenuShowing += CanChooseDataGridView_PopupMenuShowing; }
private void pivotGridControl1_PopupMenuShowing(object sender, DevExpress.XtraPivotGrid.PopupMenuShowingEventArgs e) { try { if (e.Area == DevExpress.XtraPivotGrid.PivotArea.FilterArea && e.Field != null) { if (e.Field.DataType == Type.GetType("System.DateTime")) { if (!e.Field.IsUnboundExpression) { Image splitFieldIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/format/columns_16x16.png"); DevExpress.Utils.Menu.DXMenuItem mn = new DevExpress.Utils.Menu.DXMenuItem("Split date"); mn.Image = splitFieldIcon; mn.Tag = e.Field; mn.Click += mn_Click; e.Menu.Items.Add(mn); } } } } catch (Exception ex) { XtraMessageBox.Show(ex.GetFullExceptionErrMessage()); } }
private void grv_ShowGridMenu(object sender, GridMenuEventArgs e) { if (e.MenuType != DevExpress.XtraGrid.Views.Grid.GridMenuType.Column) { return; } try { DevExpress.XtraGrid.Menu.GridViewMenu headerMenu = (DevExpress.XtraGrid.Menu.GridViewMenu)e.Menu; if (headerMenu.Items.Count > 11) { return; } DevExpress.Utils.Menu.DXMenuItem menuItem = new DevExpress.Utils.Menu.DXMenuItem("Reset Layout Grid", new EventHandler(MyMenuItem)); DevExpress.Utils.Menu.DXMenuItem menuSave = new DevExpress.Utils.Menu.DXMenuItem("Save Layout Grid", new EventHandler(MenuSave)); DevExpress.Utils.Menu.DXMenuItem menuItemClear = new DevExpress.Utils.Menu.DXMenuItem("Clear Layout Grid", new EventHandler(MenuClear)); menuItem.BeginGroup = true; menuItem.Tag = e.Menu; menuItem.BeginGroup = true; menuItemClear.Tag = e.Menu; menuSave.Tag = e.Menu; headerMenu.Items.Add(menuItem); headerMenu.Items.Add(menuItemClear); headerMenu.Items.Add(menuSave); } catch { } }
private void MyMenuItem(Object sender, EventArgs e) { DevExpress.Utils.Menu.DXMenuItem Item = sender as DevExpress.Utils.Menu.DXMenuItem; GridColumn col = Item.Tag as GridColumn; col.SummaryItem.Tag = "Count"; col.SummaryItem.SetSummary(DevExpress.Data.SummaryItemType.Custom, string.Empty); }
private void view_calendar_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) { if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Row) { DevExpress.Utils.Menu.DXMenuItem item = new DevExpress.Utils.Menu.DXMenuItem("Показать рапорт за день"); item.Click += Item_Click; e.Menu.Items.Add(item); } }
private void AddItem(TreeListMenu menu, NodeMenuItemID id, bool enabled) { DevExpress.Utils.Menu.DXMenuItem item = new DevExpress.Utils.Menu.DXMenuItem(id.ToString()); item.Tag = id; item.ImageOptions.Image = imageCollection.Images[(int)id]; item.Enabled = enabled; item.Click += OnMenuItemClick; menu.Items.Add(item); }
private void gridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e) { if (e.MenuType != DevExpress.XtraGrid.Views.Grid.GridMenuType.Summary) { return; } DevExpress.XtraGrid.Menu.GridViewFooterMenu footerMenu = e.Menu as DevExpress.XtraGrid.Menu.GridViewFooterMenu; DevExpress.Utils.Menu.DXMenuItem menuItem = new DevExpress.Utils.Menu.DXMenuItem("MyItem", new EventHandler(MyMenuItem)); menuItem.Tag = e.Menu; footerMenu.Items.Add(menuItem); }
public static void GenerateContextMenu(AgendaViewControl viewControl, GridViewMenu contextMenu, SchedulerControl control, Appointment apt) { Scheduler = control; CurrentAppointment = apt; ViewControl = viewControl; if (apt != null) { contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Open appointment", OnOpenCurrentAppointment)); contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Delete appointment", OnDeleteCurrentAppointment, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.Delete.png")))); } DevExpress.Utils.Menu.DXMenuItem nextInterval = new DevExpress.Utils.Menu.DXMenuItem("Go to the next month", OnNextInterval, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.NextArrow.png"))); nextInterval.BeginGroup = true; contextMenu.Items.Add(nextInterval); contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Go to the previous month", OnPreviousInterval, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.PrevArrow.png")))); contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Go to the specific date", OnGoToSpecificDate)); DevExpress.Utils.Menu.DXSubMenuItem switchView = new DevExpress.Utils.Menu.DXSubMenuItem("Change view to"); switchView.BeginGroup = true; contextMenu.Items.Add(switchView); if (Scheduler.DayView.Enabled) { switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Day View", OnSwitchToDayView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.DayView.png")))); } if (Scheduler.WorkWeekView.Enabled) { switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Work Week View", OnSwitchToWorkWeekView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.WorkWeekView.png")))); } if (Scheduler.WeekView.Enabled) { switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Week View", OnSwitchToWeekView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.WeekView.png")))); } if (Scheduler.MonthView.Enabled) { switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Month View", OnSwitchToMonthView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.MonthView.png")))); } if (Scheduler.TimelineView.Enabled) { switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Timeline View", OnSwitchToTimelineView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.TimelineView.png")))); } if (Scheduler.GanttView.Enabled) { switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Gantt View", OnSwitchToGanttView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.GanttView.png")))); } if (apt != null) { contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem(ViewControl.ShowResources ? "Show all appointments" : "Group appointments by resources", OnSwitchResourcesVisibility)); } }
// 노드삭제 인보크 private void deleteNodeMenuItemClick(object sender, EventArgs e) { DevExpress.Utils.Menu.DXMenuItem item = sender as DevExpress.Utils.Menu.DXMenuItem; if (item == null) { return; } TreeListNode node = item.Tag as TreeListNode; if (node == null) { return; } node.TreeList.DeleteNode(node); }
private void gvNguoiDung_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) { if (!HeThong.NguoiDungDangNhap.QuanTri) { return; } if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Row) { var item = new DevExpress.Utils.Menu.DXMenuItem(); item.Caption = LanguageHelper.TranslateString("Reset mật khẩu", "Reset mật khẩu"); item.Click += item_Click; e.Menu.Items.Add(item); } }
private void gridViewEbay_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { GridView view = sender as GridView; GridHitInfo hitInfo = view.CalcHitInfo(e.Point); if (hitInfo.InRowCell) { e.Menu.Items.Clear(); int colId = e.HitInfo.Column.ColumnHandle; int rowId = e.HitInfo.RowHandle; DevExpress.Utils.Menu.DXMenuItem dxMenuItem; dxMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Abrir Articulo", AbrirArticulo_click); e.Menu.Items.Add(dxMenuItem); dxMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Poner Disponible", PonerDisponibleArticulo_click); e.Menu.Items.Add(dxMenuItem); } }
private void schedulerControl1_PopupMenuShowing(object sender, DevExpress.XtraScheduler.PopupMenuShowingEventArgs e) { if (e.Menu.Id == DevExpress.XtraScheduler.SchedulerMenuItemId.AppointmentMenu) { // Hide the "Change View To" menu item. //DevExpress.XtraScheduler.SchedulerPopupMenu itemChangeViewTo = e.Menu.GetPopupMenuById(DevExpress.XtraScheduler.SchedulerMenuItemId.SwitchViewMenu); //itemChangeViewTo.Visible = false; //e.Menu.RemoveMenuItem(DevExpress.XtraScheduler.SchedulerMenuItemId.NewRecurringEvent); e.Menu.RemoveMenuItem(DevExpress.XtraScheduler.SchedulerMenuItemId.OpenAppointment); } DevExpress.Utils.Menu.DXMenuItem itemAc = new DevExpress.Utils.Menu.DXMenuItem("Detay Gör", new EventHandler(item_Click_RandevuAc)); e.Menu.Items.Insert(0, itemAc); DevExpress.Utils.Menu.DXMenuItem itemA = new DevExpress.Utils.Menu.DXMenuItem("Arandı Yap", new EventHandler(item_Click_Arandi)); e.Menu.Items.Insert(0, itemA); DevExpress.Utils.Menu.DXMenuItem item = new DevExpress.Utils.Menu.DXMenuItem("Sms Gönder", new EventHandler(item_Click_sms_gonder)); e.Menu.Items.Insert(0, item); DevExpress.Utils.Menu.DXMenuItem iteme = new DevExpress.Utils.Menu.DXMenuItem("E-Posta Gönder", new EventHandler(item_Click_mail_gonder)); e.Menu.Items.Insert(0, iteme); DevExpress.Utils.Menu.DXMenuItem item2 = new DevExpress.Utils.Menu.DXMenuItem("Müşteri Hareketleri", new EventHandler(item_Click_musteri_hareketleri)); e.Menu.Items.Insert(0, item2); DevExpress.Utils.Menu.DXMenuItem item0 = new DevExpress.Utils.Menu.DXMenuItem("Randevu Düzenle", new EventHandler(item_Click_RandevuDuzenle)); e.Menu.Items.Insert(0, item0); DevExpress.Utils.Menu.DXMenuItem itemYeni = new DevExpress.Utils.Menu.DXMenuItem("Yeni Özel Randevu", new EventHandler(item_Click_OzelRandevuEkle)); e.Menu.Items.Insert(0, itemYeni); DevExpress.Utils.Menu.DXMenuItem itemCopy = new DevExpress.Utils.Menu.DXMenuItem("Kopyala", new EventHandler(item_Click_Copy)); e.Menu.Items.Insert(0, itemCopy); DevExpress.Utils.Menu.DXMenuItem itemCut = new DevExpress.Utils.Menu.DXMenuItem("Kes", new EventHandler(item_Click_Cut)); e.Menu.Items.Insert(0, itemCut); DevExpress.Utils.Menu.DXMenuItem itemPaste = new DevExpress.Utils.Menu.DXMenuItem("Yapıştır", new EventHandler(item_Click_Paste)); e.Menu.Items.Insert(0, itemPaste); }
void CreateMenu(DevExpress.Utils.Menu.DXPopupMenu menu, ModuleType peekModuleType) { if (IsDockedCore(peekModuleType)) { var undockItem = new DevExpress.Utils.Menu.DXMenuItem(); undockItem.Caption = "Hide the peek"; undockItem.BindCommand((t) => ViewModel.UndockPeekModule(t), ViewModel, () => peekModuleType); menu.Items.Add(undockItem); } else { var dockItem = new DevExpress.Utils.Menu.DXMenuItem(); dockItem.Caption = "Dock the peek"; dockItem.BindCommand((t) => ViewModel.DockPeekModule(t), ViewModel, () => peekModuleType); var showItem = new DevExpress.Utils.Menu.DXMenuItem(); showItem.Caption = "Show the peek"; showItem.BindCommand((t) => ViewModel.ShowPeekModule(t), ViewModel, () => peekModuleType); menu.Items.Add(dockItem); menu.Items.Add(showItem); } }
//우클릭시 삭제x private void treeList_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && System.Windows.Forms.Control.ModifierKeys == Keys.None) { _dragStartHitInfo = (sender as TreeList).CalcHitInfo(new Point(e.X, e.Y)); } else { _dragStartHitInfo = null; } if (e.Button == MouseButtons.Right && System.Windows.Forms.Control.ModifierKeys == Keys.None) { _dragStartHitInfo = (sender as TreeList).CalcHitInfo(new Point(e.X, e.Y)); TreeListNode node = null; //아래에 트리명칭참조 //https://documentation.devexpress.com/WindowsForms/DevExpress.XtraTreeList.HitInfoType.enum //Cell : 셀클릭시 if (_dragStartHitInfo.HitInfoType == HitInfoType.Cell) { node = _dragStartHitInfo.Node; } if (node == null) { return; } //'품목삭제'메뉴 생성 TreeListMenu menu = new TreeListMenu(sender as TreeList); DevExpress.Utils.Menu.DXMenuItem menuItem = new DevExpress.Utils.Menu.DXMenuItem("&" + "Delete Row", new EventHandler(deleteNodeMenuItemClick)); menuItem.Tag = node; menu.Items.Add(menuItem); // Show the menu. menu.Show(e.Location); } else { _dragStartHitInfo = null; } }
private void gridViewArticulos_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) { GridView view = sender as GridView; GridHitInfo hitInfo = view.CalcHitInfo(e.Point); if (hitInfo.InRowCell) { e.Menu.Items.Clear(); int colId = e.HitInfo.Column.ColumnHandle; int rowId = e.HitInfo.RowHandle; DevExpress.Utils.Menu.DXMenuItem dxMenuItem; if (colNombre.ColumnEdit == null) { dxMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Mostrar nombre completo", ComoMostrarDescripcion); e.Menu.Items.Add(dxMenuItem); } else { dxMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Recortar nombre", ComoMostrarDescripcion); e.Menu.Items.Add(dxMenuItem); } } }
private void GridView_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) { if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Column) { e.Menu.Items.Clear(); DevExpress.XtraGrid.Views.BandedGrid.ViewInfo.BandedGridHitInfo bandinfo = e.HitInfo as DevExpress.XtraGrid.Views.BandedGrid.ViewInfo.BandedGridHitInfo; if (bandinfo.Band != null && bandinfo.Band.Columns.Count == 1) { BandedGridColumn Column = bandinfo.Band.Columns[0]; DevExpress.Utils.Menu.DXMenuCheckItem itemSortAZ = new DevExpress.Utils.Menu.DXMenuCheckItem(); itemSortAZ.Caption = "正序"; itemSortAZ.Image = DevExpress.XtraGrid.Menu.GridMenuImages.Column.Images[1]; itemSortAZ.Click += new EventHandler(itemSortAZ_Click); itemSortAZ.Tag = bandinfo.Band.Columns[0]; if (Column.SortOrder == DevExpress.Data.ColumnSortOrder.Ascending) { itemSortAZ.Checked = true; } e.Menu.Items.Add(itemSortAZ); DevExpress.Utils.Menu.DXMenuCheckItem itemSortZA = new DevExpress.Utils.Menu.DXMenuCheckItem(); itemSortZA.Caption = "逆序"; itemSortZA.Image = DevExpress.XtraGrid.Menu.GridMenuImages.Column.Images[2]; itemSortZA.Click += new EventHandler(itemSortZA_Click); itemSortZA.Tag = bandinfo.Band.Columns[0]; if (Column.SortOrder == DevExpress.Data.ColumnSortOrder.Descending) { itemSortZA.Checked = true; } e.Menu.Items.Add(itemSortZA); DevExpress.Utils.Menu.DXMenuItem itemSortCancel = new DevExpress.Utils.Menu.DXMenuItem(); itemSortCancel.Caption = "取消排序"; itemSortCancel.Tag = bandinfo.Band.Columns[0]; itemSortCancel.Click += new EventHandler(itemSortCancel_Click); e.Menu.Items.Add(itemSortCancel); //有列合并时禁用排序 if (bandinfo.Band.HasChildren) { itemSortAZ.Enabled = false; itemSortZA.Enabled = false; itemSortCancel.Enabled = false; } else { itemSortAZ.Enabled = true; itemSortZA.Enabled = true; itemSortCancel.Enabled = true; } DevExpress.Utils.Menu.DXMenuItem splitSort = new DevExpress.Utils.Menu.DXMenuItem(); splitSort.Caption = "-"; e.Menu.Items.Add(splitSort); if (GridView.GroupedColumns.Contains(Column)) { DevExpress.Utils.Menu.DXMenuItem itemUnGroup = new DevExpress.Utils.Menu.DXMenuItem(); itemUnGroup.Caption = "取消分组"; itemUnGroup.Image = DevExpress.XtraGrid.Menu.GridMenuImages.GroupPanel.Images[2]; itemUnGroup.Tag = bandinfo.Band.Columns[0]; itemUnGroup.Click += new EventHandler(itemUnGroup_Click); e.Menu.Items.Add(itemUnGroup); } else { DevExpress.Utils.Menu.DXMenuItem itemGroup = new DevExpress.Utils.Menu.DXMenuItem(); itemGroup.Caption = "分组"; itemGroup.Image = DevExpress.XtraGrid.Menu.GridMenuImages.Column.Images[3]; itemGroup.Tag = bandinfo.Band.Columns[0]; itemGroup.Click += new EventHandler(itemGroup_Click); e.Menu.Items.Add(itemGroup); } DevExpress.Utils.Menu.DXMenuItem itemAgvColWidth = new DevExpress.Utils.Menu.DXMenuItem(); itemAgvColWidth.Caption = "最佳列宽效果"; itemAgvColWidth.Image = DevExpress.XtraGrid.Menu.GridMenuImages.Column.Images[6]; itemAgvColWidth.Tag = bandinfo.Band.Columns[0]; itemAgvColWidth.Click += new EventHandler(itemAgvColWidth_Click); e.Menu.Items.Add(itemAgvColWidth); DevExpress.Utils.Menu.DXMenuItem splitGroup = new DevExpress.Utils.Menu.DXMenuItem(); splitGroup.Caption = "-"; e.Menu.Items.Add(splitGroup); if (GridView.OptionsView.ShowAutoFilterRow) { DevExpress.Utils.Menu.DXMenuItem itemFilerEditor = new DevExpress.Utils.Menu.DXMenuItem(); itemFilerEditor.Caption = "取消过滤行"; itemFilerEditor.Image = DevExpress.XtraGrid.Menu.GridMenuImages.Column.Images[7]; itemFilerEditor.Tag = bandinfo.Band.Columns[0]; itemFilerEditor.Click += new EventHandler(itemFilerEditor_Click); e.Menu.Items.Add(itemFilerEditor); } else { DevExpress.Utils.Menu.DXMenuItem itemFilerEditor = new DevExpress.Utils.Menu.DXMenuItem(); itemFilerEditor.Caption = "自动过滤行"; itemFilerEditor.Image = DevExpress.XtraGrid.Menu.GridMenuImages.Column.Images[8]; itemFilerEditor.Tag = bandinfo.Band.Columns[0]; itemFilerEditor.Click += new EventHandler(itemFilerEditor_Click); e.Menu.Items.Add(itemFilerEditor); } DevExpress.Utils.Menu.DXMenuItem itemFilerRow = new DevExpress.Utils.Menu.DXMenuItem(); itemFilerRow.Caption = "筛选"; itemFilerRow.Tag = bandinfo.Band.Columns[0]; itemFilerRow.Click += new EventHandler(itemFilerRow_Click); e.Menu.Items.Add(itemFilerRow); DevExpress.Utils.Menu.DXMenuItem splitFiler = new DevExpress.Utils.Menu.DXMenuItem(); splitFiler.Caption = "-"; e.Menu.Items.Add(splitFiler); if (Column.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.None) { DevExpress.Utils.Menu.DXMenuItem itemFixRow = new DevExpress.Utils.Menu.DXMenuItem(); itemFixRow.Caption = "冻结列"; itemFixRow.Tag = Column.OwnerBand; itemFixRow.Click += new EventHandler(itemFixRow_Click); e.Menu.Items.Add(itemFixRow); } else { DevExpress.Utils.Menu.DXMenuItem itemFixCancel = new DevExpress.Utils.Menu.DXMenuItem(); itemFixCancel.Caption = "取消冻结"; itemFixCancel.Tag = Column.OwnerBand; itemFixCancel.Click += new EventHandler(itemFixCancel_Click); e.Menu.Items.Add(itemFixCancel); } DevExpress.Utils.Menu.DXMenuItem splitHide = new DevExpress.Utils.Menu.DXMenuItem(); splitHide.Caption = "-"; e.Menu.Items.Add(splitHide); DevExpress.Utils.Menu.DXMenuItem itemHide = new DevExpress.Utils.Menu.DXMenuItem(); itemHide.Caption = "隐藏列"; itemHide.Tag = Column.OwnerBand; itemHide.Click += new EventHandler(itemHide_Click); e.Menu.Items.Add(itemHide); DevExpress.Utils.Menu.DXMenuItem itemShow = new DevExpress.Utils.Menu.DXMenuItem(); itemShow.Caption = "显示所有列"; itemShow.Tag = Column.OwnerBand; itemShow.Click += new EventHandler(itemShow_Click); e.Menu.Items.Add(itemShow); } } }
void mn_Click(object sender, EventArgs e) { DevExpress.Utils.Menu.DXMenuItem mn = (DevExpress.Utils.Menu.DXMenuItem)sender; DevExpress.XtraPivotGrid.PivotGridField clickedField = (DevExpress.XtraPivotGrid.PivotGridField)mn.Tag; AddXtraDateFeildsManually(clickedField, true); }
private void MyMenuItem(Object sender, EventArgs e) { DevExpress.Utils.Menu.DXMenuItem Item = sender as DevExpress.Utils.Menu.DXMenuItem; DevExpress.XtraGrid.Menu.GridViewFooterMenu menu = Item.Tag as DevExpress.XtraGrid.Menu.GridViewFooterMenu; MessageBox.Show(menu.View.FocusedColumn.FieldName); }
private void gridView1_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) { if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Row) { if (e.HitInfo.InRow && e.HitInfo.RowInfo != null) { DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)sender; dynamic obj = null; object itm = gv.GetRow(gv.FocusedRowHandle); string displaytext = String.Empty; List <string> columns = new List <string>(); DataRow drSelected = null; if (itm != null) { Int64 id = 0; if (itm is System.Data.DataRowView) { drSelected = ((System.Data.DataRowView)itm).Row; id = (Int64)((System.Data.DataRowView)itm).Row[0]; foreach (System.Text.RegularExpressions.Match match in System.Text.RegularExpressions.Regex.Matches(this.ListOfType.DisplayText, @"(?<!\w)@\w+")) { columns.Add(match.Value); } displaytext = this.ListOfType.DisplayText; columns.ForEach(c => displaytext = displaytext.Replace(c, drSelected[c.Replace("@", "")].ToString())); } else { obj = itm; } } DevExpress.XtraGrid.Menu.GridViewMenu menu = e.Menu as DevExpress.XtraGrid.Menu.GridViewMenu; menu.Items.Clear(); DevExpress.Utils.Menu.DXMenuItem mgr = new DevExpress.Utils.Menu.DXMenuItem(); mgr.Caption = $"Edit {displaytext}"; mgr.Click += delegate(object o, EventArgs args) { LoadEntityForm((DevExpress.XtraGrid.Views.Grid.GridView)sender); }; menu.Items.Add(mgr); DataTable dt = new DataTable(); MyApp.CTech.ExecSQL($"SELECT * FROM MenuItemContextMenu WHERE Menuitem = {this.ListOfType.ID}", ref dt); foreach (DataRow dr in dt.Rows) { DevExpress.Utils.Menu.DXMenuItem mnu = new DevExpress.Utils.Menu.DXMenuItem(); mnu.Caption = dr.Field <string>("DisplayText"); mnu.Click += delegate(object o, EventArgs args) { System.Reflection.MethodInfo theMethod = this.ListOfType.RuntimeObjectType.GetMethod(dr.Field <string>("Event")); if (theMethod != null) { var x = theMethod.Invoke(obj, new object[] { }); this.ReloadDataSource(); } }; menu.Items.Add(mnu); } mgr = new DevExpress.Utils.Menu.DXMenuItem(); mgr.BeginGroup = true; mgr.Caption = $"Excel(xlsx) Export"; mgr.Click += delegate(object o, EventArgs args) { SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "*.xlsx|*.xlsx"; dlg.DefaultExt = ".xlsx"; if (dlg.ShowDialog() == DialogResult.OK) { cntrlSearch1.gridView1.ExportToXlsx(dlg.FileName); System.Diagnostics.Process.Start(dlg.FileName); } }; menu.Items.Add(mgr); } } }
void CreateMenu(DevExpress.Utils.Menu.DXPopupMenu menu, ModuleType peekModuleType) { if(IsDockedCore(peekModuleType)) { var undockItem = new DevExpress.Utils.Menu.DXMenuItem(); undockItem.Caption = "Hide the peek"; undockItem.BindCommand((t) => ViewModel.UndockPeekModule(t), ViewModel, () => peekModuleType); menu.Items.Add(undockItem); } else { var dockItem = new DevExpress.Utils.Menu.DXMenuItem(); dockItem.Caption = "Dock the peek"; dockItem.BindCommand((t) => ViewModel.DockPeekModule(t), ViewModel, () => peekModuleType); var showItem = new DevExpress.Utils.Menu.DXMenuItem(); showItem.Caption = "Show the peek"; showItem.BindCommand((t) => ViewModel.ShowPeekModule(t), ViewModel, () => peekModuleType); menu.Items.Add(dockItem); menu.Items.Add(showItem); } }
public MyGridView() { if (!DesignMode) { this.OptionsView.ColumnAutoWidth = false; this.OptionsView.ShowAutoFilterRow = true; this.OptionsView.ShowFooter = true; this.OptionsView.EnableAppearanceEvenRow = true; this.OptionsMenu.ShowGroupSummaryEditorItem = true; } //Labels //Should calling after datasource settings ApplyLabelToColumns(); this.DataSourceChanged += (s, e) => { if (!this.DesignMode) { XPCollection ds = null; if (this.DataSource is XPCollection) //Level 1 { ds = (XPCollection)this.DataSource; if (ds != null) { this.BeginInit(); ApplyLabel((XPCollection)ds); ds.CollectionChanged += (sndr, arg) => { if (arg.CollectionChangedType == DevExpress.Xpo.XPCollectionChangedType.AfterRemove) { if (ds.Session is UnitOfWork)//Should be UnitOfWork to use extension method SaveLine { UnitOfWork unit = (UnitOfWork)ds.Session; unit.Delete(arg.ChangedObject); //unit.SaveLine(); } } }; this.EndInit(); } } else if (this.DataSource is BindingSource && this.ClassInfo != null && this.UnitOfWorkXpo != null) { this.BeginInit(); var xpClassInfo = UnitOfWorkXpo.GetClassInfo(this.ClassInfo); ApplyLabel(xpClassInfo); this.EndInit(); } //ApplyLabelToColumns(); } }; this.InitNewRow += (s, e) => { try { switch (this.OptionsBehavior.EditingMode) { case GridEditingMode.EditForm: case GridEditingMode.EditFormInplace: case GridEditingMode.EditFormInplaceHideCurrentRow: this.ShowEditForm(); break; default: break; } } catch (Exception) { } }; this.FocusedRowChanged += (s, e) => { var row = this.GetRow(e.FocusedRowHandle); if (row != null && row is XPLiteObject) { FormRecord.CurrentRecord = (XPLiteObject)row; //Assign current row to Args if (this.GridControl.FindForm() != null && this.GridControl.FindForm().GetType() == typeof(MyForm)) { ((MyForm)this.GridControl.FindForm()).Args.Record = (XPLiteObject)row; } } }; if (this.EnableAutoSave) { this.ValidateRow += (s, e) => { try { e.Valid = UnitOfWorkXpo.SaveLine(); } catch (Exception ex) { XtraMessageBox.Show(ex.GetFullExceptionErrMessage()); } }; } this.PopupMenuShowing += (sender, argE) => { var gv = (MyGridView)sender; gv.OptionsMenu.ShowConditionalFormattingItem = true; //Row menu configuration #region RowMenu if (argE.HitInfo.InRow) { DevExpress.Utils.Menu.DXMenuItem printGridMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Print"); DevExpress.Utils.Menu.DXMenuItem previewGridMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Preview"); DevExpress.Utils.Menu.DXMenuItem exportMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Export"); DevExpress.Utils.Menu.DXMenuItem refreshMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Refresh"); DevExpress.Utils.Menu.DXMenuItem conditionalFormatMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Conditional Format"); DevExpress.Utils.Menu.DXMenuItem saveLayoutMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Save layout"); DevExpress.Utils.Menu.DXMenuItem restoreLayoutMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Restore layout"); DevExpress.Utils.Menu.DXMenuItem clearLayoutMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Clear layout settings"); DevExpress.Utils.Menu.DXMenuItem bulkUpdateMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Multi rows update"); DevExpress.Utils.Menu.DXMenuItem pivotGridMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Pivot grid"); DevExpress.Utils.Menu.DXMenuItem sendSMSMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Send SMS"); DevExpress.Utils.Menu.DXMenuItem viewDetailsMenuItem = new DevExpress.Utils.Menu.DXMenuItem("View details"); //get icons Image printGridIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/print/print_16x16.png"); Image previewGridIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/print/preview_16x16.png"); Image exportIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/export/exporttoxlsx_16x16.png"); Image refreshIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/refresh2_16x16.png"); Image conditionalFormatIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/miscellaneous/palette_16x16.png"); Image saveLayoutIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/reports/addgroupheader_16x16.png"); Image restoreLayoutIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/reports/deletegroupheader_16x16.png"); Image clearLayoutIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/save/saveandclose_16x16.png"); Image bulkUpdateLayoutIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/programming/scripts_16x16.png"); Image pivotGridIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/grid/pivot_16x16.png"); Image sendSMSIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/mail/editfeed_16x16.png"); Image viewDetailsIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("devav/actions/showproduct_16x16.png"); //Assign icon to its menus printGridMenuItem.Image = printGridIcon; previewGridMenuItem.Image = previewGridIcon; exportMenuItem.Image = exportIcon; refreshMenuItem.Image = refreshIcon; conditionalFormatMenuItem.Image = conditionalFormatIcon; saveLayoutMenuItem.Image = saveLayoutIcon; restoreLayoutMenuItem.Image = restoreLayoutIcon; clearLayoutMenuItem.Image = clearLayoutIcon; bulkUpdateMenuItem.Image = bulkUpdateLayoutIcon; pivotGridMenuItem.Image = pivotGridIcon; sendSMSMenuItem.Image = sendSMSIcon; viewDetailsMenuItem.Image = viewDetailsIcon; //Link this grid view to menu object via Tag property printGridMenuItem.Tag = gv; previewGridMenuItem.Tag = gv; exportMenuItem.Tag = gv; refreshMenuItem.Tag = gv; conditionalFormatMenuItem.Tag = gv; saveLayoutMenuItem.Tag = gv; restoreLayoutMenuItem.Tag = gv; clearLayoutMenuItem.Tag = gv; bulkUpdateMenuItem.Tag = gv; pivotGridMenuItem.Tag = gv; sendSMSMenuItem.Tag = gv; viewDetailsMenuItem.Tag = gv; //Event handler for each menu item //======================================================================================= printGridMenuItem.Click += (s, e) => { this.OptionsPrint.ExpandAllDetails = false;//To reserve user settings during printing this.OptionsPrint.ExpandAllGroups = false; this.Print(); }; previewGridMenuItem.Click += (s, e) => { AppService.PreviewXtraGrid previewXtraGrid; try { this.OptionsPrint.ExpandAllDetails = false;//To reserve user settings during printing this.OptionsPrint.ExpandAllGroups = false; previewXtraGrid = new AppService.PreviewXtraGrid(gv.GridControl); previewXtraGrid.PrintableGridLink.Landscape = true; previewXtraGrid.ShowPreviewDialog(); } catch (Exception ex) { XtraMessageBox.Show(ex.GetFullExceptionErrMessage()); } }; exportMenuItem.Click += (s, e) => { string fileName = ""; fileName = GlobalMethods.AskUser_SaveFilePath("Xlsx"); if (string.IsNullOrEmpty(fileName)) { return; } gv.ExportToXls(fileName); }; refreshMenuItem.Click += (s, e) => { gv.UnitOfWorkXpo.ReloadChangedObjects(); }; pivotGridMenuItem.Click += (s, e) => { try { AppService.XtraGridPopupMenu_PivotXtraForm frm = new AppService.XtraGridPopupMenu_PivotXtraForm(this); //Inhriet pivot form from caller form //frm.IsSaveLayout = parentForm.IsSaveLayout;Disable this option //frm.IsPreviewable = parentForm.IsPreviewable; //frm.IsPrintable = parentForm.IsPrintable; //frm.IsExportable = parentForm.IsExportable; var parentForm = this.GridControl.TopLevelControl as XtraForm; if (parentForm.IsMdiChild) { frm.MdiParent = parentForm; frm.WindowState = FormWindowState.Maximized; frm.Show(); //Stacked windows StackingChildForms(MdiLayout.TileHorizontal, parentForm, frm); } else { frm.WindowState = FormWindowState.Maximized; frm.ShowDialog(); } } catch (Exception ex) { XtraMessageBox.Show(ex.GetFullExceptionErrMessage()); } }; viewDetailsMenuItem.Click += (s, e) => { if (argE.HitInfo.InRow && argE.HitInfo.RowHandle >= 0) { var colInfo = (GridColumnInfo)argE.HitInfo.Column.Tag; if (colInfo == null) { return; } if (colInfo.IsViewDetails) { colInfo.FormArgs = new Args(); //Save current row value string cellVal = this.GetRowCellValue(argE.HitInfo.RowHandle, argE.HitInfo.Column).ToString(); var col = argE.HitInfo.Column; if (col.ColumnType == typeof(string) || col.ColumnType == typeof(DateTime)) { cellVal = $"'{cellVal}'"; } colInfo.FormArgs.Caller = this.GridControl.FindForm(); colInfo.FormArgs.LookupField = colInfo.ColumnLablel.LookupEditor.LookupValueField; colInfo.FormArgs.LookupValue = cellVal; colInfo.FormArgs.Record = (XPBaseObject)GetRow(argE.HitInfo.RowHandle); OnViewDetails(new ViewDetailsEventArgs(colInfo, this)); } } }; //======================================================================================= //Add menu to grid //======================================================================================= argE.Menu.Items.Add(printGridMenuItem); argE.Menu.Items.Add(previewGridMenuItem); argE.Menu.Items.Add(exportMenuItem); argE.Menu.Items.Add(pivotGridMenuItem); argE.Menu.Items.Add(refreshMenuItem); argE.Menu.Items.Add(viewDetailsMenuItem); } #endregion #region ColumnMenu if (argE.HitInfo.InColumn) { //Checked filter with sub menu DevExpress.Utils.Menu.DXSubMenuItem checkedFilterSubMenuItem = new DevExpress.Utils.Menu.DXSubMenuItem("Filter popup mode"); DevExpress.Utils.Menu.DXMenuItem checkedListOptionMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Checked list"); DevExpress.Utils.Menu.DXMenuItem listOptionMenuItem = new DevExpress.Utils.Menu.DXMenuItem("List"); DevExpress.Utils.Menu.DXMenuItem defaultOptionMenuItem = new DevExpress.Utils.Menu.DXMenuItem("Default"); checkedFilterSubMenuItem.Items.Add(defaultOptionMenuItem); checkedFilterSubMenuItem.Items.Add(checkedListOptionMenuItem); checkedFilterSubMenuItem.Items.Add(listOptionMenuItem); System.Drawing.Image filterIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/programming/forcetesting_16x16.png"); System.Drawing.Image freezeIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/alignment/alignverticalleft_16x16.png"); System.Drawing.Image expColumnIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/programming/scripts_16x16.png"); System.Drawing.Image removeColumnIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/reports/deleteheader_16x16.png"); System.Drawing.Image columnsSetupIcon = DevExpress.Images.ImageResourceCache.Default.GetImage("images/grid/customizegrid_16x16.png"); checkedFilterSubMenuItem.Image = filterIcon; checkedFilterSubMenuItem.ImageDisabled = filterIcon; checkedFilterSubMenuItem.LargeImage = filterIcon; checkedFilterSubMenuItem.LargeImageDisabled = filterIcon; defaultOptionMenuItem.Click += (s, e) => { argE.HitInfo.Column.OptionsFilter.FilterPopupMode = DevExpress.XtraGrid.Columns.FilterPopupMode.Default; }; checkedListOptionMenuItem.Click += (s, e) => { argE.HitInfo.Column.OptionsFilter.FilterPopupMode = DevExpress.XtraGrid.Columns.FilterPopupMode.CheckedList; }; listOptionMenuItem.Click += (s, e) => { argE.HitInfo.Column.OptionsFilter.FilterPopupMode = DevExpress.XtraGrid.Columns.FilterPopupMode.List; }; defaultOptionMenuItem.Tag = argE.HitInfo; checkedListOptionMenuItem.Tag = argE.HitInfo; listOptionMenuItem.Tag = argE.HitInfo; argE.Menu.Items.Add(checkedFilterSubMenuItem); //Freeze column DevExpress.Utils.Menu.DXSubMenuItem freezeColumnSubMenuItem = new DevExpress.Utils.Menu.DXSubMenuItem("Freeze column"); freezeColumnSubMenuItem.Image = freezeIcon; freezeColumnSubMenuItem.ImageDisabled = freezeIcon; freezeColumnSubMenuItem.LargeImage = freezeIcon; freezeColumnSubMenuItem.LargeImageDisabled = freezeIcon; DevExpress.Utils.Menu.DXMenuItem freezeColumnToLeft = new DevExpress.Utils.Menu.DXMenuItem("Left"); DevExpress.Utils.Menu.DXMenuItem freezeColumnToRight = new DevExpress.Utils.Menu.DXMenuItem("Right"); DevExpress.Utils.Menu.DXMenuItem freezeColumnClear = new DevExpress.Utils.Menu.DXMenuItem("None"); freezeColumnSubMenuItem.Items.Add(freezeColumnToLeft); freezeColumnSubMenuItem.Items.Add(freezeColumnToRight); freezeColumnSubMenuItem.Items.Add(freezeColumnClear); freezeColumnToLeft.Click += (s, e) => { argE.HitInfo.Column.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; }; freezeColumnToRight.Click += (s, e) => { argE.HitInfo.Column.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Right; }; freezeColumnClear.Click += (s, e) => { argE.HitInfo.Column.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.None; }; freezeColumnToLeft.Tag = argE.HitInfo; freezeColumnToRight.Tag = argE.HitInfo; freezeColumnClear.Tag = argE.HitInfo; argE.Menu.Items.Add(freezeColumnSubMenuItem); if (argE.HitInfo.Column.UnboundType == DevExpress.Data.UnboundColumnType.Bound) { DevExpress.Utils.Menu.DXMenuItem addExpColumnMenu = new DevExpress.Utils.Menu.DXMenuItem("New expression column"); addExpColumnMenu.Image = expColumnIcon; addExpColumnMenu.Tag = gv; addExpColumnMenu.Click += (s, e) => { CoreLib.Grid.AppService.ExpressionColumnOptionsXtraForm frm = new AppService.ExpressionColumnOptionsXtraForm(this); frm.ShowDialog(); }; argE.Menu.Items.Add(addExpColumnMenu); } else { DevExpress.Utils.Menu.DXMenuItem removeExpColumnMenu = new DevExpress.Utils.Menu.DXMenuItem("Remove expression column"); removeExpColumnMenu.Image = removeColumnIcon; removeExpColumnMenu.Tag = argE.HitInfo; removeExpColumnMenu.Click += (s, e) => { argE.HitInfo.Column.View.Columns.Remove(argE.HitInfo.Column); }; argE.Menu.Items.Add(removeExpColumnMenu); } //Column setup DevExpress.Utils.Menu.DXMenuItem setupColumnsMenu = new DevExpress.Utils.Menu.DXMenuItem("Advanced settings"); setupColumnsMenu.Image = columnsSetupIcon; setupColumnsMenu.Tag = gv; setupColumnsMenu.Click += (s, e) => //setupColumnsMenu_Click { AppService.XtraGridPopupMenu_ColumnsReorderXtraForm frm = new XtraGridPopupMenu_ColumnsReorderXtraForm(gv); frm.Show(); }; argE.Menu.Items.Add(setupColumnsMenu); } #endregion }; }
private void InsertMenu(DevExpress.XtraTreeList.Menu.TreeListColumnMenu Menu) { // Insert Menu DevExpress.XtraTreeList.Menu.TreeListColumnMenu menu = (DevExpress.XtraTreeList.Menu.TreeListColumnMenu)Menu; if (menu.Column == null) return; #region 1. Auto Filter - Dev Chưa hỗ trợ #endregion #region 2. Lọc nâng cao - Dev Chưa hỗ trợ #endregion #region 3. Tính toán trong nhóm DevExpress.Utils.Menu.DXMenuItem itemDisplayFooter; itemDisplayFooter = new DevExpress.Utils.Menu.DXMenuItem("Hiện thanh tính toán"); itemDisplayFooter.BeginGroup = true; if (this.OptionsView.ShowSummaryFooter == true) itemDisplayFooter.Caption = "Ẩn thanh tính toán"; itemDisplayFooter.Click += delegate(object sender, EventArgs e){ this.OptionsView.ShowSummaryFooter = !this.OptionsView.ShowSummaryFooter; }; Menu.Items.Add(itemDisplayFooter); #endregion #region 4. Canh lề DevExpress.Utils.Menu.DXSubMenuItem itemDisplayData = new DevExpress.Utils.Menu.DXSubMenuItem("Canh lề"); itemDisplayData.BeginGroup = true; Menu.Items.Add(itemDisplayData); DevExpress.Utils.Menu.DXMenuCheckItem itemLeft = new DevExpress.Utils.Menu.DXMenuCheckItem("Lề trái"); DevExpress.Utils.Menu.DXMenuCheckItem itemRight = new DevExpress.Utils.Menu.DXMenuCheckItem("Lề phải"); DevExpress.Utils.Menu.DXMenuCheckItem itemCenter = new DevExpress.Utils.Menu.DXMenuCheckItem("Lề giữa"); itemDisplayData.Items.Add(itemLeft); itemDisplayData.Items.Add(itemRight); itemDisplayData.Items.Add(itemCenter); itemLeft.Tag = menu.Column.AbsoluteIndex; itemRight.Tag = menu.Column.AbsoluteIndex; itemCenter.Tag = menu.Column.AbsoluteIndex; itemLeft.Click += new EventHandler(itemLeft_Click); itemRight.Click += new EventHandler(itemRight_Click); itemCenter.Click += new EventHandler(itemCenter_Click); itemLeft.Checked = (this.Columns[menu.Column.AbsoluteIndex].AppearanceCell.TextOptions.HAlignment == DevExpress.Utils.HorzAlignment.Near); itemRight.Checked = (this.Columns[menu.Column.AbsoluteIndex].AppearanceCell.TextOptions.HAlignment == DevExpress.Utils.HorzAlignment.Far); itemCenter.Checked = (this.Columns[menu.Column.AbsoluteIndex].AppearanceCell.TextOptions.HAlignment == DevExpress.Utils.HorzAlignment.Center); #endregion #region 5. Cố định cột - Chưa hỗ trợ #endregion #region 6. Xuất ra file bool isExport = true; if (_ExportElement != null) { if (_ExportElement is DevExpress.XtraBars.BarItem) { if (((DevExpress.XtraBars.BarItem)_ExportElement).Visibility == DevExpress.XtraBars.BarItemVisibility.Never) isExport = false; } else if (_ExportElement is DevExpress.XtraEditors.SimpleButton) { if (((DevExpress.XtraEditors.SimpleButton)_ExportElement).Visible == false) isExport = false; } else if (_ExportElement is System.Windows.Forms.ToolStripDropDownButton) { if (((System.Windows.Forms.ToolStripDropDownButton)_ExportElement).Visible == false) isExport = false; } } if (isExport) { //SubMenu Export Data DevExpress.Utils.Menu.DXSubMenuItem itemExport = new DevExpress.Utils.Menu.DXSubMenuItem("Xuất ra file"); itemExport.BeginGroup = true; Menu.Items.Add(itemExport); //Menu Export Excel DevExpress.Utils.Menu.DXMenuItem itemExportExcel = new DevExpress.Utils.Menu.DXMenuItem("Excel 97 - 2003"); itemExport.Items.Add(itemExportExcel); itemExportExcel.Tag = "xls"; itemExportExcel.Click += new EventHandler(itemExport_Click); DevExpress.Utils.Menu.DXMenuItem itemExportExcel2007 = new DevExpress.Utils.Menu.DXMenuItem("Excel 2007"); itemExport.Items.Add(itemExportExcel2007); itemExportExcel2007.Tag = "xlsx"; itemExportExcel2007.Click += new EventHandler(itemExport_Click); DevExpress.Utils.Menu.DXMenuItem itemPDF = new DevExpress.Utils.Menu.DXMenuItem("PDF"); itemExport.Items.Add(itemPDF); itemPDF.Tag = "pdf"; itemPDF.Click += new EventHandler(itemExport_Click); //Menu Export HTML DevExpress.Utils.Menu.DXMenuItem itemExportHTML = new DevExpress.Utils.Menu.DXMenuItem("HTML"); itemExport.Items.Add(itemExportHTML); itemExportHTML.Tag = "html"; itemExportHTML.Click += new EventHandler(itemExport_Click); //Menu Export Text DevExpress.Utils.Menu.DXMenuItem itemExportText = new DevExpress.Utils.Menu.DXMenuItem("RTF"); itemExport.Items.Add(itemExportText); itemExportText.Tag = "rtf"; itemExportText.Click += new EventHandler(itemExport_Click); } #endregion #region 7. In dữ liệu bool isPrint = true; if (_PrintElement != null) { if (_PrintElement is DevExpress.XtraBars.BarItem) { if (((DevExpress.XtraBars.BarItem)_PrintElement).Visibility == DevExpress.XtraBars.BarItemVisibility.Never) isPrint = false; } else if (_PrintElement is DevExpress.XtraEditors.SimpleButton) { if (((DevExpress.XtraEditors.SimpleButton)_PrintElement).Visible == false) isPrint = false; } else if (_PrintElement is System.Windows.Forms.ToolStripDropDownButton) { if (((System.Windows.Forms.ToolStripDropDownButton)_PrintElement).Visible == false) isPrint = false; } } if (isPrint) { DevExpress.Utils.Menu.DXMenuItem itemPrintData = new DevExpress.Utils.Menu.DXMenuItem("Xem trước khi in"); itemPrintData.BeginGroup = true; Menu.Items.Add(itemPrintData); itemPrintData.Click += new EventHandler(itemPrintData_Click); } #endregion #region 8. Hình dạng cây - Chưa hỗ trợ #endregion #region 9. Hỗ trợ debug - Chưa hỗ trợ #endregion }