Пример #1
0
        DXMenuItem CreateSubMenuRows(GridView view, int rowHandle)
        {
            DXSubMenuItem subMenu = new DXSubMenuItem("Rows");

            DXMenuItem menuItemCopyRow = new DXMenuItem("Copy this row", new EventHandler(OnCopyRowClick));

            menuItemCopyRow.Tag     = new RowInfo(view, rowHandle);
            menuItemCopyRow.Enabled = view.IsDataRow(rowHandle) || view.IsGroupRow(rowHandle);
            subMenu.Items.Add(menuItemCopyRow);

            DXMenuItem menuItemCopyTableRow = new DXMenuItem("Copy this table", new EventHandler(OnCopyTableClick));

            menuItemCopyTableRow.Tag     = new RowInfo(view, rowHandle);
            menuItemCopyTableRow.Enabled = view.IsDataRow(rowHandle) || view.IsGroupRow(rowHandle);
            subMenu.Items.Add(menuItemCopyTableRow);

            string deleteRowsCommandCaption;

            if (view.IsGroupRow(rowHandle))
            {
                deleteRowsCommandCaption = "Delete rows in this group";
            }
            else
            {
                deleteRowsCommandCaption = "Delete this row";
            }
            DXMenuItem menuItemDeleteRow = new DXMenuItem(deleteRowsCommandCaption, new EventHandler(OnDeleteRowClick));

            menuItemDeleteRow.Tag     = new RowInfo(view, rowHandle);
            menuItemDeleteRow.Enabled = view.IsDataRow(rowHandle) || view.IsGroupRow(rowHandle);
            subMenu.Items.Add(menuItemDeleteRow);
            return(subMenu);
        }
        protected override void CreateItems()
        {
            base.Items.Clear();
            DXSubMenuItem dXSubMenuItem = new DXSubMenuItem("Danh Sách Các Cột")
            {
                Image = GridMenuImages.Column.Images[5]
            };

            base.Items.Add(dXSubMenuItem);
            base.Items.Add(base.CreateMenuItem("Tuỳ Chọn Cột", GridMenuImages.Column.Images[4], "Customization", true));
            base.Items.Add(base.CreateMenuItem("Co Giãn Cột", GridMenuImages.Column.Images[6], "BestFit", true));
            if (!base.View.OptionsView.ShowGroupPanel)
            {
                base.Items.Add(this.CreateMenuItem("Hiện Khung Nhóm Dữ Liệu", null, "ShowGroupPanel", true, true));
            }
            else
            {
                base.Items.Add(this.CreateMenuItem("Ẩn Khung Nhóm Dữ Liệu", null, "HideGroupPanel", true, true));
            }
            base.Items.Add(this.CreateMenuCheckItem("Chọn Hết", false, null, "SelectAll", true, true));
            base.Items.Add(this.CreateMenuItem("Bỏ Chọn", null, "UnSelectAll", true, false));
            base.Items.Add(this.CreateMenuItem("Lưu Lại Vị Trí Và Sắp Xếp Các Cột", null, "SaveLayout", true, true));
            base.Items.Add(base.CreateMenuItem("Lấy Lại Vị Trí Và Sắp Xếp Mặc Định", null, "DefaultLayout", true));
            foreach (GridColumn column in base.View.Columns)
            {
                if (column.OptionsColumn.ShowInCustomizationForm)
                {
                    dXSubMenuItem.Items.Add(base.CreateMenuCheckItem(column.GetTextCaption(), column.VisibleIndex >= 0, null, column, true));
                }
            }
        }
Пример #3
0
        void pivotGridControl1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
        {
            if (e.MenuType == PivotGridMenuType.HeaderSummaries)
            {
                int i = 0;
                while (i < e.Menu.Items.Count)
                {
                    if (!necessaryItems.Contains(e.Menu.Items[i].Caption))
                    {
                        e.Menu.Items.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }

                DXSubMenuItem displayType = new DXSubMenuItem("SummaryDisplayType");
                e.Menu.Items.Add(displayType);

                string curentSummaryDisplayType = Enum.GetName(typeof(PivotSummaryDisplayType), e.Field.SummaryDisplayType);
                foreach (string str in Enum.GetNames(typeof(PivotSummaryDisplayType)))
                {
                    DXMenuCheckItem item = new DXMenuCheckItem(str, curentSummaryDisplayType == str);
                    item.Click += new EventHandler(ItemClick);
                    item.Tag    = e.Field;
                    displayType.Items.Add(item);
                }
            }
        }
Пример #4
0
        ///////////////////////////////////////////////////////////////////////////////////////////////
        // Override(Event, Properties, Method...)
        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region :: CreateItems :: Menu Item을 생성합니다.

        /// <summary>
        /// Menu Item을 생성합니다.
        /// </summary>
        protected override void CreateItems()
        {
            Items.Clear();
            string keyName = String.Format("{0}{1}", (View.GridControl.FindForm() as UIFrame).MenuID, View.Name);

            StringBuilder sb = new StringBuilder(128);

            Win32Util.GetPrivateProfileString("GridLayout", keyName, "", sb, 128, AppConfig.SETTINGFILEPATH);

            DXSubMenuItem columnsItem = new DXSubMenuItem("Columns");

            Items.Add(columnsItem);
            Items.Add(CreateMenuItem("컬럼 사용자지정", GridMenuImages.Column.Images[5], "Customization", true));

            //Items.Add(CreateMenuItem("컬럼 Layout 불러오기", null, "LayoutLoad", sb.ToString() == string.Empty || !File.Exists(sb.ToString()) ? false : true, true));
            Items.Add(CreateMenuItem("컬럼 Layout 저장", null, "LayoutSave", true));
            Items.Add(CreateMenuItem("컬럼 Layout 삭제", null, "LayoutDelete", sb.ToString() == string.Empty || !File.Exists(sb.ToString()) ? false : true));

            foreach (GridColumn column in View.Columns)
            {
                if (column.OptionsColumn.ShowInCustomizationForm)
                {
                    columnsItem.Items.Add(CreateMenuCheckItem(column.GetTextCaption(), column.VisibleIndex >= 0, null, column, true));
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Добавить в меню пункты по выбору способа выделения ячеек
        /// </summary>
        /// <param name="menu">Меню</param>
        /// <param name="selectCustom">Метод для обработки случая выборки нескольких ячеек</param>
        /// <param name="selectRow">Метод для обработки случая выборки нескольких строк</param>
        /// <param name="selectRows">Метод для обработки случая выборки одной строки</param>
        public static void DXCreateSelectSelectionMenu(DXPopupMenu menu, EventHandler selectCustom, EventHandler selectRow, EventHandler selectRows)
        {
            var dxsmiSelect = new DXSubMenuItem("Способы выделения ячеек")
            {
                Image = Resources.table_select
            };
            var dxmiSelectRows = new DXMenuItem("Колонка для выделения")
            {
                Image = Resources.check_box_list
            };
            var dxmiSelectCustom = new DXMenuItem("Выделение нескольких ячеек")
            {
                Image = Resources.table_select_group
            };
            var dxmiSelectRow = new DXMenuItem("Выделение строк")
            {
                Image = Resources.table_select_row
            };

            dxmiSelectCustom.Click += selectCustom;
            dxmiSelectRow.Click    += selectRow;
            dxmiSelectRows.Click   += selectRows;

            dxsmiSelect.Items.Add(dxmiSelectRow);
            dxsmiSelect.Items.Add(dxmiSelectRows);
            dxsmiSelect.Items.Add(dxmiSelectCustom);

            menu.Items.Add(dxsmiSelect);
        }
Пример #6
0
        /// <summary>
        /// Erweiterung der Popup-Menüs
        /// </summary>
        private void OnPopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
        {
            PivotGridField pivotGridField = e.HitInfo.HeaderField;

            if (pivotGridField != null)
            {
                // PivotSummaryType
                DXSubMenuItem summaryMenuItem = new DXSubMenuItem {
                    Caption = "Zusammenfassung", BeginGroup = true
                };
                e.Menu.Items.Add(summaryMenuItem);
                Dictionary <string, PivotSummaryType> summaryTypes = new Dictionary <string, PivotSummaryType>
                {
                    { "Summe", PivotSummaryType.Sum },
                    { "Durchschnitt", PivotSummaryType.Average },
                    { "Anzahl", PivotSummaryType.Count },
                    { "Minimum", PivotSummaryType.Min },
                    { "Maximum", PivotSummaryType.Max },
                };
                foreach (string key in summaryTypes.Keys)
                {
                    PivotSummaryType summaryType = summaryTypes[key];
                    DXMenuCheckItem  menuItem    = new DXMenuCheckItem {
                        Caption = key, Checked = pivotGridField.SummaryType == summaryType
                    };
                    menuItem.Click += delegate
                    { this.DuplicatePivotGridField(pivotGridField, summaryType, pivotGridField.SummaryDisplayType); };
                    summaryMenuItem.Items.Add(menuItem);
                }

                // PivotSummaryDisplayType
                DXSubMenuItem summaryDisplayMenuItem = new DXSubMenuItem {
                    Caption = "Anzeigen als"
                };
                e.Menu.Items.Add(summaryDisplayMenuItem);
                Dictionary <string, PivotSummaryDisplayType> summaryDisplayTypes = new Dictionary <string, PivotSummaryDisplayType>
                {
                    { "Standard", PivotSummaryDisplayType.Default },
                    { "Varianz zum Vorgänger (absolut)", PivotSummaryDisplayType.AbsoluteVariation },
                    { "Varianz zum Vorgänger (prozentual)", PivotSummaryDisplayType.PercentVariation },
                    { "Prozent vom Gesamt (Spalte)", PivotSummaryDisplayType.PercentOfColumn },
                    { "Prozent vom Gesamt (Zeile)", PivotSummaryDisplayType.PercentOfRow },
                    { "Prozent vom Gesamtergebnis (Spalte)", PivotSummaryDisplayType.PercentOfColumnGrandTotal },
                    { "Prozent vom Gesamtergebnis (Zeile)", PivotSummaryDisplayType.PercentOfRowGrandTotal },
                };
                foreach (string key in summaryDisplayTypes.Keys)
                {
                    PivotSummaryDisplayType summaryDisplayType = summaryDisplayTypes[key];
                    DXMenuCheckItem         menuItem           = new DXMenuCheckItem {
                        Caption = key, Checked = pivotGridField.SummaryDisplayType == summaryDisplayType
                    };
                    menuItem.Click += delegate { this.DuplicatePivotGridField(pivotGridField, pivotGridField.SummaryType, summaryDisplayType); };
                    summaryDisplayMenuItem.Items.Add(menuItem);
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Скрыть стандартные кнопки из меню Грида
        /// </summary>
        private static void HideCustomizationColumns(DXSubMenuItem menu)
        {
            var showColumns = menu.Items
                              .Cast <DXMenuItem>()
                              .FirstOrDefault(i => i.Tag is TreeListStringId && (TreeListStringId)i.Tag == TreeListStringId.MenuColumnColumnCustomization);

            if (showColumns != null)
            {
                showColumns.Visible = false;
            }
        }
Пример #8
0
        /// <summary>
        ///     Добавить новую кнопку в контекстное меню
        /// </summary>
        /// <param name="dxsmi">Кнопка меню, к которой нужно добавить кнопку</param>
        /// <param name="name">Название кнопки</param>
        /// <param name="click">Обработчик нажатия</param>
        /// <param name="tag">Tag</param>
        /// <param name="glyph">Изображение на кнопке</param>
        private static void AddBarButton(DXSubMenuItem dxsmi, string name, EventHandler click, object tag = null, Bitmap glyph = null)
        {
            var addBarButton = new DXMenuItem
            {
                Caption = name,
                Image   = glyph,
                Tag     = tag
            };

            addBarButton.Click += click;
            dxsmi.Items.Add(addBarButton);
        }
Пример #9
0
        protected void GridView_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e)
        {
            GridViewMenu gridViewMenu = e.Menu as GridViewMenu;

            if (gridViewMenu == null)
            {
                return;
            }

            DXMenuItem    menuItem = new DXMenuItem("Column Properties");
            DXMenuItem    gridViewPropertyMenuItem        = new DXMenuItem("Grid View Property");
            DXMenuItem    gridViewSaveLayoutMenuItem      = new DXMenuItem("Save Layout");
            DXMenuItem    gridViewSaveToXlsxItem          = new DXMenuItem("Save to Xlsx (WYSIWYG)");
            DXMenuItem    gridViewSaveToXlsxDataAwareItem = new DXMenuItem("Save to Xlsx (Data-Aware)");
            DXMenuItem    saveDefaultLayoutMenuItem       = new DXMenuItem("Save as Default Layout");
            DXMenuItem    printPreviewMenuItem            = new DXMenuItem("Print Preview");
            DXSubMenuItem subMenuItem   = new DXSubMenuItem("Layout");
            DXSubMenuItem exportSubMenu = new DXSubMenuItem("Export && Print");

            if (e.MenuType == GridMenuType.Column)
            {
                GridViewColumnMenu menu = e.Menu as GridViewColumnMenu;
                if (menu.Column != null)
                {
                    column          = e.HitInfo.Column;
                    menuItem.Click += GridForm_GridViewColumnMenu_click;
                    subMenuItem.Items.Add(menuItem);
                }
            }

            subMenuItem.Items.Add(gridViewPropertyMenuItem);
            subMenuItem.Items.Add(gridViewSaveLayoutMenuItem);
            exportSubMenu.Items.Add(gridViewSaveToXlsxItem);
            exportSubMenu.Items.Add(gridViewSaveToXlsxDataAwareItem);
            exportSubMenu.Items.Add(printPreviewMenuItem);
            subMenuItem.Items.Add(saveDefaultLayoutMenuItem);
            gridViewMenu.Items.Add(exportSubMenu);
            gridViewMenu.Items.Add(subMenuItem);
            gridViewPropertyMenuItem.Click        += GridForm_GridViewPropertyMenuItem_Click;
            gridViewSaveLayoutMenuItem.Click      += GridForm_GridViewSaveLayoutMenuItem_Click;
            gridViewSaveToXlsxItem.Click          += GridForm_GridViewSaveToXlsxItem_Click;
            gridViewSaveToXlsxDataAwareItem.Click += GridForm_GridViewSaveToXlsxDataAwareItem_Click;
            printPreviewMenuItem.Click            += PrintPreviewMenuItem_Click;
            saveDefaultLayoutMenuItem.Click       += SaveDefaultLayoutMenuItem_Click;
            if (!IsOwner)
            {
                gridViewPropertyMenuItem.Visible = false;
                menuItem.Visible = false;
                saveDefaultLayoutMenuItem.Visible = false;
            }
        }
Пример #10
0
        private void PivotGrid_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
        {
            DXMenuItem fieldPropertyMenuItem     = new DXMenuItem("Field Property");
            DXMenuItem pivotSaveLayoutMenuItem   = new DXMenuItem("Save Layout");
            DXMenuItem pivotSaveToXlsxMenuItem   = new DXMenuItem("Save to Xlsx (WYSIWYG)");
            DXMenuItem pivotLayoutProperty       = new DXMenuItem("Pivot Property");
            DXMenuItem saveDefaultLayoutMenuItem = new DXMenuItem("Save as Default Layout");
            DXMenuItem addNewField        = new DXMenuItem("Add New Empty Field");
            DXMenuItem removeCurrentField = new DXMenuItem("Remove Field");
            DXMenuItem pivotSaveToXlsxDataAwareMenuItem = new DXMenuItem("Save to Xlsx (Data-Aware)");
            DXMenuItem pivotPrintPreviewMenuItem        = new DXMenuItem("Print Preview");

            DXSubMenuItem subMenuItem   = new DXSubMenuItem("Layout");
            DXSubMenuItem exportSubMenu = new DXSubMenuItem("Export && Print");

            e.Menu.Items.Add(subMenuItem);
            e.Menu.Items.Add(exportSubMenu);
            subMenuItem.Items.Add(addNewField);
            subMenuItem.Items.Add(pivotSaveLayoutMenuItem);
            subMenuItem.Items.Add(saveDefaultLayoutMenuItem);
            exportSubMenu.Items.Add(pivotSaveToXlsxMenuItem);
            exportSubMenu.Items.Add(pivotSaveToXlsxDataAwareMenuItem);
            exportSubMenu.Items.Add(pivotPrintPreviewMenuItem);

            if (e.MenuType == PivotGridMenuType.Header)
            {
                field = e.Field;

                fieldPropertyMenuItem.Click += FieldPropertyMenuItem_Click;
                removeCurrentField.Click    += RemoveCurrentField_Click;
                subMenuItem.Items.Add(fieldPropertyMenuItem);
                subMenuItem.Items.Add(removeCurrentField);
            }
            pivotSaveLayoutMenuItem.Click          += PivotSaveLayoutMenuItem_Click;
            pivotSaveToXlsxMenuItem.Click          += PivotSaveToXlsxMenuItem_Click;
            pivotSaveToXlsxDataAwareMenuItem.Click += PivotSaveToXlsxDataAwareMenuItem_Click;
            pivotLayoutProperty.Click       += PivotLayoutProperty_Click;
            pivotPrintPreviewMenuItem.Click += PivotPrintPreviewMenuItem_Click;
            saveDefaultLayoutMenuItem.Click += SaveDefaultLayoutMenuItem_Click;
            addNewField.Click += AddNewField_Click;

            if (!IsOwnwer)
            {
                pivotLayoutProperty.Visible       = false;
                fieldPropertyMenuItem.Visible     = false;
                saveDefaultLayoutMenuItem.Visible = false;
                removeCurrentField.Visible        = false;
                addNewField.Visible = false;
            }
        }
Пример #11
0
        private void DXCreateLayoutMenuItems()
        {
            var ribeNewStateName = new RepositoryItemButtonEdit
            {
                AutoHeight = false,
                NullText   = @"Введите имя"
            };

            ribeNewStateName.Buttons.Clear();
            ribeNewStateName.Buttons.Add(new EditorButton(ButtonPredefines.Glyph)
            {
                Image   = Resources.save,
                ToolTip = "Сохранить состояние с введённым именем"
            });
            var dxmeNewLayout = new DXEditMenuItem
            {
                Image = Resources.layout_add,
                Edit  = ribeNewStateName,
                Width = 100
            };
            var dxdmiNewState = new DXSubMenuItem("Сохранить состояние")
            {
                BeginGroup = true,
                Image      = Resources.saveas
            };
            var dxmiDefaultState = new DXMenuItem("Начальное состояние")
            {
                Image = Resources.layout_default
            };
            var dxmiLastState = new DXMenuItem("Последнее сохранённое")
            {
                Image = Resources.layout_link
            };

            //Создаём обработчики событий для меню
            menu.BeforePopup             += BeforePopupMenuLayout;
            ribeNewStateName.ButtonClick += NewStateNameButtonClick;
            bbiDeleteStates.Click        += DeleteStatesItemClick;
            dxmiDefaultState.Click       += DefaultStateItemClick;
            dxmiLastState.Click          += LastStateItemClick;

            //Распределяем кнопки по меню
            dxdmiNewState.Items.Add(dxmeNewLayout);
            menu.Items.Add(dxdmiNewState);
            menu.Items.Add(dxsmiSaved);
            menu.Items.Add(dxsmiRemove);
            menu.Items.Add(dxmiDefaultState);
            menu.Items.Add(dxmiLastState);
        }
Пример #12
0
        public static DXMenuItem CreateRowSubMenu(GridView view, int rowHandle)
        {
            m_grv = view;
            DXSubMenuItem subMenu            = new DXSubMenuItem("Báo cáo");
            DXMenuItem    menuItemReportXLS  = new DXMenuItem("&Báo cáo XLS", new EventHandler(ExportXLSClick));
            DXMenuItem    menuItemReportPDF  = new DXMenuItem("&Báo cáo PDF", new EventHandler(ExportPDFClick));
            DXMenuItem    menuItemReportHTML = new DXMenuItem("&Báo cáo HTML", new EventHandler(ExportHTMLClick));
            DXMenuItem    menuItemReportDOC  = new DXMenuItem("&Báo cáo TXT", new EventHandler(ExportDOCClick));

            subMenu.Items.Add(menuItemReportXLS);
            subMenu.Items.Add(menuItemReportPDF);
            subMenu.Items.Add(menuItemReportHTML);
            subMenu.Items.Add(menuItemReportDOC);
            return(subMenu);
        }
Пример #13
0
        protected DXSubMenuItem CreateSetBookmarkMenu()
        {
            DXSubMenuItem menuItem     = new DXSubMenuItem(SetBookmarkStr);
            EventHandler  eventHandler = new EventHandler(SetBookmarkMenuItem_Click);

            for (int i = 0; i < BookmarkCount; i++)
            {
                DXMenuCheckItem item = new DXMenuCheckItem(BookmarkStr + i.ToString());
                item.Click  += eventHandler;
                item.Tag     = i;
                item.Checked = BookMarks[i] != null;
                menuItem.Items.Add(item);
            }
            return(menuItem);
        }
Пример #14
0
        protected DXSubMenuItem CreateGotoBookmarkMenu()
        {
            DXSubMenuItem menuItem     = new DXSubMenuItem(GotoBookmarkStr);
            EventHandler  eventHandler = new EventHandler(GotoBookmarkMenuItem_Click);

            for (int i = 0; i < BookmarkCount; i++)
            {
                if (BookMarks[i] != null)
                {
                    DXMenuItem item = new DXMenuItem(BookmarkStr + i.ToString(), eventHandler);
                    item.Tag = i;
                    menuItem.Items.Add(item);
                }
            }
            return(menuItem);
        }
Пример #15
0
        // Create a submenu with a single DeleteRow item.
        DXMenuItem CreateRowSubMenu(GridView view, int rowHandle)
        {
            var subMenu         = new DXSubMenuItem("Chọn");
            var menuItemEditRow = new DXMenuItem("&Sửa", new EventHandler(OnDeleteRowClick), imageCollection1.Images[58])
            {
                Tag = new RowInfo(view, rowHandle)
            };
            var menuItemDeleteRow = new DXMenuItem("&Xóa", new EventHandler(OnDeleteRowClick), imageCollection1.Images[36])
            {
                Tag = new RowInfo(view, rowHandle)
            };

            subMenu.Items.Add(menuItemEditRow);
            subMenu.Items.Add(menuItemDeleteRow);
            return(subMenu);
        }
Пример #16
0
        // Create menu items.?
        // This method is automatically called by the menu's public Init method.?


        protected override void CreateItems()
        {
            Items.Clear();
            DXSubMenuItem columnsItem = new DXSubMenuItem("删除");

            columnsItem.Click += EV;
            Items.Add(columnsItem);
            //Items.Add(columnsItem);
            //Items.Add(CreateMenuItem("Runtime Column Customization", GridMenuImages.Column.Images[3],
            //  "Customization", true));
            //foreach (GridColumn column in View.Columns)
            //{
            //    if (column.OptionsColumn.ShowInCustomizationForm)
            //        columnsItem.Items.Add(CreateMenuCheckItem(column.Caption, column.VisibleIndex >= 0,
            //          null, column, true));
            //}
        }
        void InsertMenuItems(TreeListMenu menu, Dictionary <string, EventHandler> menuItemsCaptionsAndHandlers)
        {
            int           mainIndex   = 0;
            int           subIndex    = 0;
            bool          beginGroup  = false;
            DXSubMenuItem actDropDown = null;

            foreach (string menuItemCaption_wm in menuItemsCaptionsAndHandlers.Keys) //wm = with marker
            {
                bool   isSubMenuHeader = menuItemCaption_wm.StartsWith(_subMenuHeadMarker);
                bool   isSubMenu       = menuItemCaption_wm.StartsWith(_subMenuMarker);
                string menuItemCaption = (isSubMenuHeader || isSubMenu) ? menuItemCaption_wm.Substring(1) : menuItemCaption_wm;

                if (menuItemCaption.StartsWith(_menuSeparator1))
                {
                    beginGroup = true;
                    continue;
                }

                DXMenuItem menuItem = null;
                if (isSubMenuHeader)
                {
                    actDropDown = new DXSubMenuItem(menuItemCaption);
                    menuItem    = actDropDown;
                    subIndex    = 0;
                }
                else
                {
                    menuItem = new DXMenuItem(menuItemCaption, new EventHandler(menuItemsCaptionsAndHandlers[menuItemCaption_wm]));
                }

                menuItem.BeginGroup = beginGroup;
                beginGroup          = false;
                GreyState(menuItem);

                if (isSubMenu)
                {
                    actDropDown.Items.Insert(subIndex++, menuItem);
                }
                else
                {
                    menu.Items.Insert(mainIndex++, menuItem);
                }
            }
        }
Пример #18
0
 private DXCustomMenuCreator(EditorContainer _editor, ref DXPopupMenu _menu)
 {
     editor = _editor;
     menu = _menu;
     controlForm = editor.FindForm();
     dxsmiSaved = new DXSubMenuItem("Сохраненные состояния")
     {
         Image = Resources.layout_save
     };
     bbiDeleteStates = new DXMenuItem("Удалить выбранные")
     {
         Image = Resources.Remove
     };
     dxsmiRemove = new DXSubMenuItem("Удалить состояния")
     {
         Image = Resources.layout_delete
     };
 }
Пример #19
0
 private DXCustomMenuCreator(EditorContainer _editor, ref DXPopupMenu _menu)
 {
     editor      = _editor;
     menu        = _menu;
     controlForm = editor.FindForm();
     dxsmiSaved  = new DXSubMenuItem("Сохраненные состояния")
     {
         Image = Resources.layout_save
     };
     bbiDeleteStates = new DXMenuItem("Удалить выбранные")
     {
         Image = Resources.Remove
     };
     dxsmiRemove = new DXSubMenuItem("Удалить состояния")
     {
         Image = Resources.layout_delete
     };
 }
        void pivotGridControl1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
        {
            if (e.MenuType == PivotGridMenuType.HeaderSummaries)
            {
                DXSubMenuItem sdtItem = new DXSubMenuItem();
                sdtItem.Caption = "Summary Display Type";
                e.Menu.Items.Add(sdtItem);

                string curentSummaryDisplayType = Enum.GetName(typeof(PivotSummaryDisplayType), e.Field.SummaryDisplayType);
                foreach (string str in Enum.GetNames(typeof(PivotSummaryDisplayType)))
                {
                    DXMenuCheckItem item = new DXMenuCheckItem(str, curentSummaryDisplayType == str);
                    item.Click += new EventHandler(ItemClick);
                    item.Tag    = e.Field;
                    sdtItem.Items.Add(item);
                }
            }
        }
Пример #21
0
        private void myGridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e)
        {
            if (e.MenuType != DevExpress.XtraGrid.Views.Grid.GridMenuType.Summary)
            {
                return;
            }
            if (e.Menu == null)
            {
                return;
            }
            DXSubMenuItem subItem = new DXSubMenuItem();

            subItem.Caption = "Item 2";
            DXMenuItem myItem = new DXMenuItem("Now!");

            myItem.Click += myItem_Click;
            subItem.Items.Add(myItem);
            e.Menu.Items.Add(subItem);
        }
      DXMenuItem CreateRowSubMenuGrafico(GridView view, int rowHandle)
      {
          DXSubMenuItem subMenu = new DXSubMenuItem("Operaciones");

          DXMenuItem menuItemGrafico = new DXMenuItem("&Agregar Nuevo Detalle",
                                                      new EventHandler(AgregarGrilla), imageCollection1.Images[0]);

          menuItemGrafico.Tag = new RowInfo(view, rowHandle);
          subMenu.Items.Add(menuItemGrafico);



          DXMenuItem menuItemGraficoLabor = new DXMenuItem("&Eliminar Detalle",
                                                           new EventHandler(EliminarGrilla), imageCollection1.Images[1]);

          menuItemGraficoLabor.Tag = new RowInfo(view, rowHandle);
          subMenu.Items.Add(menuItemGraficoLabor);


          return(subMenu);
      }
Пример #23
0
        /// <summary>
        /// Áp dụng UnboundExpression cho lưới
        /// </summary>
        /// <param name="gridView">Lưới áp dụng</param>
        public static void AppUnboundExpression(GridView gridView)
        {
            gridView.ShowGridMenu += delegate(object sender, GridMenuEventArgs e) {
                if (e.Menu is GridViewColumnMenu)
                {
                    GridViewColumnMenu menu = (GridViewColumnMenu)e.Menu;
                    if (menu.Column != null)
                    {
                        #region Cột tính trên lưới
                        DXSubMenuItem item = new DXSubMenuItem("Thêm cột tính");
                        item.BeginGroup = true;
                        menu.Items.Add(item);
                        item.Click += delegate(object senderItem, EventArgs eItem)
                        {
                            InputBoxResult input = HelpMsgBox._showMsgInput("Nhập tên cột cần tạo");
                            if (input.ReturnCode == DialogResult.OK)
                            {
                                string Field = input.Text.Trim();
                                GridColumn column = HelpGridColumn.ThemCot(gridView, Field, gridView.Columns.Count + 1, 100);
                                column.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
                                column.FieldName = Field;
                                column.OptionsColumn.AllowEdit = false;
                                column.ShowUnboundExpressionMenu = true;
                            }
                        };

                        if (menu.Column.ShowUnboundExpressionMenu)
                        {
                            DXSubMenuItem itemXoa = new DXSubMenuItem("Xóa cột tính này");
                            menu.Items.Add(itemXoa);
                            itemXoa.Click += delegate(object senderXoa, EventArgs eXoa)
                            {
                                gridView.Columns.Remove(menu.Column);
                            };
                        }
                        #endregion
                    }
                }
            };
        }
Пример #24
0
 /// <summary>
 /// Tùy chọn gom nhóm
 /// </summary>
 /// <param name="gridView"></param>
 public static void AppGroupInterval(GridView gridView)
 {
     gridView.ShowGridMenu += delegate(object sender, GridMenuEventArgs e)
     {
         if (e.Menu is GridViewColumnMenu)
         {
             GridViewColumnMenu menu = (GridViewColumnMenu)e.Menu;
             if (menu.Column != null)
             {
                 #region Thêm item GroupInterval
                 DXSubMenuItem itemDateInterval = new DXSubMenuItem("Tùy chọn gom nhóm (GroupInterval)");
                 itemDateInterval.BeginGroup = true;
                 menu.Items.Add(itemDateInterval);
                 itemDateInterval.Click += delegate(object senderDateInterval, EventArgs eDateInterval)
                 {
                     HelpProtocolForm.ShowModalDialog((XtraForm)gridView.GridControl.FindForm(), new frmGroupIntervalOption(gridView));
                 };
                 #endregion
             }
         }
     };
 }
Пример #25
0
            // Create menu items.
            // This method is automatically called by the menu's public Init method.
            protected override void CreateItems()
            {
                Items.Clear();
                DXSubMenuItem columnsItem = new DXSubMenuItem("Columns");

                //Items.Add(CreateMenuItem("Runtime Column Customization", GridMenuImages.Column.Images[3],
                //  "Customization", true));
                Items.Add(CreateMenuItem("Копировать все в буфер", Properties.Resources.Copy, "Copy all", true));
                Items.Add(CreateMenuItem("Вставить из буфера", Properties.Resources.Paste, "Paste", true));
                //Items.Add(CreateMenuItem("Вставить 1000 строк", null, "Paste 1000 rows", true));
                //Items.Add(CreateMenuItem("Вставить 10000 строк", null, "Paste 10000 rows", true));
                Items.Add(CreateMenuItem("Удалить все", Properties.Resources.DeleteAll, "Remove all", true));
                Items.Add(CreateMenuItem("Экспорт...", Properties.Resources.Export, "Export...", true));

                if (SubMenuItems != null)
                {
                    for (int i = 0; i < SubMenuItems.Count; i++)
                    {
                        Items.Add(SubMenuItems[i]);
                    }
                }
            }
Пример #26
0
        public static void AddFontAndColortoPopupMenuShowing(object sender, PopupMenuShowingEventArgs e, GridControl gridcontrol, string FormName)
        {
            //nếu sử dụng thì tích hợp save layout.
            if (e.MenuType == GridMenuType.Column)
            {
                GridViewColumnMenu menu = e.Menu as GridViewColumnMenu;
                //menu.Items.Clear();
                if (menu.Column != null)
                {
                    var renameCap = new DXMenuCheckItem("Đổi tên cột");
                    renameCap.ImageOptions.SvgImage = Properties.Resource.editnames;
                    renameCap.Click += (ss, ee) =>
                    {
                        var caption          = menu.Column.Caption;
                        frmRenameCaption frm = new frmRenameCaption(caption);

                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            menu.Column.Caption = frm.Caption;
                        }
                    };

                    menu.Items.Add(renameCap);

                    var fixLeft = new DXMenuCheckItem("Ghim Trái");
                    fixLeft.ImageOptions.SvgImage = Properties.Resource.showlegendinsideverticalcenterleft;
                    menu.Items.Add(fixLeft);
                    fixLeft.Click += (ss, ee) =>
                    {
                        menu.Column.Fixed = FixedStyle.Left;
                    };

                    var fixRight = new DXMenuCheckItem("Ghim Phải");
                    fixRight.ImageOptions.SvgImage = Properties.Resource.showlegendinsideverticalcenterright;
                    menu.Items.Add(fixRight);
                    fixRight.Click += (ss, ee) =>
                    {
                        menu.Column.Fixed = FixedStyle.Right;
                    };

                    var unFix = new DXMenuCheckItem("Xóa Ghim");
                    unFix.ImageOptions.SvgImage = Properties.Resource.manual;
                    unFix.Enabled = menu.Column.Fixed != FixedStyle.None;
                    menu.Items.Add(unFix);
                    unFix.Click += (ss, ee) =>
                    {
                        menu.Column.Fixed = FixedStyle.None;
                    };
                    // font chữ

                    DXMenuCheckItem font = new DXMenuCheckItem("Fonts", true);
                    font.ImageOptions.SvgImage = Properties.Resource.changetextcase;
                    font.Click += new EventHandler(OnFixedClick);
                    font.Tag    = new MenuInfo(menu.Column, FixedStyle.None);
                    menu.Items.Add(font);

                    // Màu nền
                    DXSubMenuItem sItem = new DXSubMenuItem("Màu Nền");
                    sItem.ImageOptions.SvgImage = Properties.Resource.pagecolor;
                    Color mauhong   = ColorTranslator.FromHtml("#FFC2BE");
                    Color mauxanh   = ColorTranslator.FromHtml("#A8D5FF");
                    Color xanhduong = ColorTranslator.FromHtml("#C1F49C");
                    Color mauvang   = ColorTranslator.FromHtml("#FEF7A5");
                    Color mautim    = ColorTranslator.FromHtml("#E0CFE9");
                    Color xanhlam   = ColorTranslator.FromHtml("#8DE9DF");
                    Color mautrang  = ColorTranslator.FromHtml("#FFFFFF");
                    Color mauden    = ColorTranslator.FromHtml("#000000");

                    sItem.Items.Add(CreateCheckItem("Color White", menu.Column, FixedStyle.None, mautrang));
                    sItem.Items.Add(CreateCheckItem("Color Black", menu.Column, FixedStyle.None, mauden));
                    sItem.Items.Add(CreateCheckItem("Color Pink", menu.Column, FixedStyle.None, mauhong));
                    sItem.Items.Add(CreateCheckItem("Color Blue", menu.Column, FixedStyle.None, mauxanh));
                    sItem.Items.Add(CreateCheckItem("Color Green", menu.Column, FixedStyle.None, xanhduong));
                    sItem.Items.Add(CreateCheckItem("Color Yellow", menu.Column, FixedStyle.None, mauvang));
                    sItem.Items.Add(CreateCheckItem("Color Purple", menu.Column, FixedStyle.None, mautim));
                    sItem.Items.Add(CreateCheckItem("Color Cyan", menu.Column, FixedStyle.None, xanhlam));

                    sItem.Items.Add(CreateCheckItem("Color Customize...", menu.Column, FixedStyle.None, Color.Transparent));
                    menu.Items.Add(sItem);

                    // màu chữ
                    var mauchu = new DXSubMenuItem("Màu Chữ");
                    mauchu.ImageOptions.SvgImage = Properties.Resource.floatingobjectfillcolor;
                    Color Red        = Color.Red;
                    Color pink       = ColorTranslator.FromHtml("#E91E63");
                    Color purple     = ColorTranslator.FromHtml("#9C27B0");
                    Color DeepPurple = ColorTranslator.FromHtml("#673AB7");
                    Color Indigo     = ColorTranslator.FromHtml("#E0CFE9");
                    Color blue       = ColorTranslator.FromHtml("#3F51B5");
                    Color cyan       = ColorTranslator.FromHtml("#00BCD4");
                    Color Teal       = ColorTranslator.FromHtml("#009688");
                    Color green      = ColorTranslator.FromHtml("#4CAF50");
                    Color Lime       = ColorTranslator.FromHtml("#CDDC39");
                    Color Amber      = ColorTranslator.FromHtml("#FFC107");
                    Color Orange     = ColorTranslator.FromHtml("#FF9800");
                    Color depOrange  = ColorTranslator.FromHtml("#FF5722");
                    Color brown      = ColorTranslator.FromHtml("#795548");
                    Color grey       = ColorTranslator.FromHtml("#9E9E9E");
                    Color BlueGrey   = ColorTranslator.FromHtml("#607D8B");
                    Color Black      = ColorTranslator.FromHtml("#000000");
                    Color White      = ColorTranslator.FromHtml("#FFFFFF");

                    mauchu.Items.Add(CreateCheckItem("Black", menu.Column, FixedStyle.None, Black));
                    mauchu.Items.Add(CreateCheckItem("White", menu.Column, FixedStyle.None, White));
                    mauchu.Items.Add(CreateCheckItem("Pink", menu.Column, FixedStyle.None, pink));
                    mauchu.Items.Add(CreateCheckItem("Purple", menu.Column, FixedStyle.None, purple));
                    mauchu.Items.Add(CreateCheckItem("Deep Purple", menu.Column, FixedStyle.None, DeepPurple));
                    mauchu.Items.Add(CreateCheckItem("Indigo", menu.Column, FixedStyle.None, Indigo));
                    // mauchu.Items.Add(CreateCheckItem("Red", menu.Column, FixedStyle.None, Red));
                    mauchu.Items.Add(CreateCheckItem("Blue", menu.Column, FixedStyle.None, blue));
                    mauchu.Items.Add(CreateCheckItem("Cyan", menu.Column, FixedStyle.None, cyan));
                    mauchu.Items.Add(CreateCheckItem("Teal", menu.Column, FixedStyle.None, Teal));
                    mauchu.Items.Add(CreateCheckItem("Green", menu.Column, FixedStyle.None, green));
                    mauchu.Items.Add(CreateCheckItem("Lime", menu.Column, FixedStyle.None, Lime));
                    mauchu.Items.Add(CreateCheckItem("Amber", menu.Column, FixedStyle.None, Amber));
                    mauchu.Items.Add(CreateCheckItem("Orange", menu.Column, FixedStyle.None, Orange));
                    mauchu.Items.Add(CreateCheckItem("Deep Orange", menu.Column, FixedStyle.None, depOrange));
                    mauchu.Items.Add(CreateCheckItem("Brown", menu.Column, FixedStyle.None, brown));
                    mauchu.Items.Add(CreateCheckItem("Grey", menu.Column, FixedStyle.None, grey));
                    mauchu.Items.Add(CreateCheckItem("Blue Grey", menu.Column, FixedStyle.None, BlueGrey));

                    mauchu.Items.Add(CreateCheckItem("ForeColor Customize...", menu.Column, FixedStyle.None, Color.Transparent));
                    menu.Items.Add(mauchu);

                    DXMenuCheckItem save_layout = new DXMenuCheckItem("Lưu Kiểu", true);
                    save_layout.ImageOptions.SvgImage = Properties.Resource.saveas;
                    save_layout.CheckedChanged       += (ss, ee) =>
                    {
                        var path = TEMP_PATH + "\\" + FormName + "\\" + gridcontrol.Name + "\\custom_layout.xml";
                        gridcontrol.MainView.SaveLayoutToXml(path, OptionsLayoutBase.FullLayout);
                        //FrmMain.Instance.ShowMessageInfo("Đã lưu cấu hình layout.");
                    };
                    DXMenuCheckItem reset_layout = new DXMenuCheckItem("Kiểu mặc định", true);
                    reset_layout.CheckedChanged += (ss, ee) =>
                    {
                        var path        = TEMP_PATH + "\\" + FormName + "\\" + gridcontrol.Name + "\\default_layout.xml";
                        var path_custom = TEMP_PATH + "\\" + FormName + "\\" + gridcontrol.Name + "\\custom_layout.xml";
                        if (File.Exists(path))
                        {
                            gridcontrol.MainView.RestoreLayoutFromXml(path, OptionsLayoutBase.FullLayout);
                            //FrmMain.Instance.ShowMessageInfo("Reset layout thành công.");
                        }

                        if (File.Exists(path_custom))
                        {
                            File.Delete(path_custom);
                        }
                    };
                    reset_layout.ImageOptions.SvgImage = Properties.Resource.bo_audit_changehistory;
                    menu.Items.Add(save_layout);
                    menu.Items.Add(reset_layout);
                }
            }
        }
Пример #27
0
        private void InsertMenu(DevExpress.XtraGrid.Menu.GridViewColumnMenu Menu)
        {
            // Insert Menu
            DevExpress.XtraGrid.Menu.GridViewColumnMenu menu = (DevExpress.XtraGrid.Menu.GridViewColumnMenu)Menu;
            if (menu.Column == null) return;

            #region 1 Auto filter
            //Hiện Auto Filter
            if (this.OptionsView.ShowAutoFilterRow == false)
            {
                DevExpress.Utils.Menu.DXMenuItem itemAutoFilter;
                itemAutoFilter = new DevExpress.Utils.Menu.DXMenuItem("Hiện Auto Filter");
                itemAutoFilter.BeginGroup = true;
                itemAutoFilter.Click += new EventHandler(itemAutoFilter_Click);
                Menu.Items.Add(itemAutoFilter);
            }
            else
            {
                //Ẩn Auto Filter
                DevExpress.Utils.Menu.DXMenuItem itemHideAutoFilter;
                itemHideAutoFilter = new DevExpress.Utils.Menu.DXMenuItem("Ẩn Auto Filter");
                itemHideAutoFilter.BeginGroup = true;
                itemHideAutoFilter.Click += new EventHandler(itemHideAutoFilter_Click);
                Menu.Items.Add(itemHideAutoFilter);
            }
            //Cách filter trong AutoFilter
            DevExpress.Utils.Menu.DXSubMenuItem filterType = new DevExpress.Utils.Menu.DXSubMenuItem("Auto Filter theo dạng");
            Menu.Items.Add(filterType);

            DevExpress.Utils.Menu.DXMenuCheckItem filterEqualType = new DevExpress.Utils.Menu.DXMenuCheckItem("Lọc bằng (=)");
            filterEqualType.Tag = menu.Column.AbsoluteIndex;
            filterEqualType.Click += new EventHandler(filterEqualType_Click);
            filterType.Items.Add(filterEqualType);
            filterEqualType.Checked = (this.Columns[menu.Column.AbsoluteIndex].OptionsFilter.AutoFilterCondition == AutoFilterCondition.Equals);

            DevExpress.Utils.Menu.DXMenuCheckItem filterLikeType = new DevExpress.Utils.Menu.DXMenuCheckItem("Lọc giống (Like)");
            filterLikeType.Tag = menu.Column.AbsoluteIndex;
            filterLikeType.Click += new EventHandler(filterLikeType_Click);
            filterType.Items.Add(filterLikeType);
            filterLikeType.Checked = (this.Columns[menu.Column.AbsoluteIndex].OptionsFilter.AutoFilterCondition == AutoFilterCondition.Like);

            DevExpress.Utils.Menu.DXMenuCheckItem filterCotainType = new DevExpress.Utils.Menu.DXMenuCheckItem("Lọc chứa (Contains)");
            filterCotainType.Tag = menu.Column.AbsoluteIndex;
            filterCotainType.Click += new EventHandler(filterCotainType_Click);
            filterType.Items.Add(filterCotainType);
            filterCotainType.Checked = (this.Columns[menu.Column.AbsoluteIndex].OptionsFilter.AutoFilterCondition == AutoFilterCondition.Contains);
            #endregion

            #region 2. Lọc nâng cao
            if (this._fullQueryData != null)
            {
                DevExpress.Utils.Menu.DXMenuItem itemSaveFilter;
                itemSaveFilter = new DevExpress.Utils.Menu.DXMenuItem("Lọc nâng cao");
                itemSaveFilter.BeginGroup = true;
                itemSaveFilter.Click += new EventHandler(itemSaveFilter_Click);
                Menu.Items.Add(itemSaveFilter);
            }
            #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.ShowFooter == true)
                itemDisplayFooter.Caption = "Ẩn thanh tính toán";
            itemDisplayFooter.Click += new EventHandler(itemDisplayFooter_Click);
            Menu.Items.Add(itemDisplayFooter);

            if (this.GroupedColumns.Count > 0)
            {
                DevExpress.Utils.Menu.DXSubMenuItem calcTotalColumn = new DevExpress.Utils.Menu.DXSubMenuItem("Tính toán nhóm");
                Menu.Items.Add(calcTotalColumn);

                DevExpress.Utils.Menu.DXMenuItem countCalc;
                countCalc = new DevExpress.Utils.Menu.DXMenuItem("Tính số dòng");
                countCalc.Tag = menu.Column.AbsoluteIndex;
                countCalc.Click += new EventHandler(countCalc_Click);
                calcTotalColumn.Items.Add(countCalc);

                DevExpress.Utils.Menu.DXMenuItem sumCalc;
                sumCalc = new DevExpress.Utils.Menu.DXMenuItem("Tính tổng cộng");
                sumCalc.Tag = menu.Column.AbsoluteIndex;
                sumCalc.Click += new EventHandler(sumCalc_Click);
                calcTotalColumn.Items.Add(sumCalc);

                DevExpress.Utils.Menu.DXMenuItem averageCalc;
                averageCalc = new DevExpress.Utils.Menu.DXMenuItem("Tính trung bình");
                averageCalc.Tag = menu.Column.AbsoluteIndex;
                averageCalc.Click += new EventHandler(averageCalc_Click);
                calcTotalColumn.Items.Add(averageCalc);

                DevExpress.Utils.Menu.DXMenuItem maxCalc;
                maxCalc = new DevExpress.Utils.Menu.DXMenuItem("Tính cực đại");
                maxCalc.Tag = menu.Column.AbsoluteIndex;
                maxCalc.Click += new EventHandler(maxCalc_Click);
                calcTotalColumn.Items.Add(maxCalc);

                DevExpress.Utils.Menu.DXMenuItem minCalc;
                minCalc = new DevExpress.Utils.Menu.DXMenuItem("Tính cực tiểu");
                minCalc.Tag = menu.Column.AbsoluteIndex;
                minCalc.Click += new EventHandler(minCalc_Click);
                calcTotalColumn.Items.Add(minCalc);
            }
            #endregion

            #region 4. Canh lề
            // Menu Display Data
            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("Canh trái");
            itemLeft.Tag = menu.Column.AbsoluteIndex;
            itemLeft.Click += new EventHandler(itemLeft_Click);
            itemDisplayData.Items.Add(itemLeft);
            itemLeft.Checked = (this.Columns[menu.Column.AbsoluteIndex].AppearanceCell.TextOptions.HAlignment == DevExpress.Utils.HorzAlignment.Near);

            DevExpress.Utils.Menu.DXMenuCheckItem itemRight = new DevExpress.Utils.Menu.DXMenuCheckItem("Canh phải");
            itemRight.Tag = menu.Column.AbsoluteIndex;
            itemRight.Click += new EventHandler(itemRight_Click);
            itemDisplayData.Items.Add(itemRight);
            itemRight.Checked = (this.Columns[menu.Column.AbsoluteIndex].AppearanceCell.TextOptions.HAlignment == DevExpress.Utils.HorzAlignment.Far);

            DevExpress.Utils.Menu.DXMenuCheckItem itemCenter = new DevExpress.Utils.Menu.DXMenuCheckItem("Canh giữa");
            itemCenter.Tag = menu.Column.AbsoluteIndex;
            itemCenter.Click += new EventHandler(itemCenter_Click);
            itemDisplayData.Items.Add(itemCenter);
            itemCenter.Checked = (this.Columns[menu.Column.AbsoluteIndex].AppearanceCell.TextOptions.HAlignment == DevExpress.Utils.HorzAlignment.Center);

            #endregion

            #region 5. Cố định cột
            DevExpress.Utils.Menu.DXSubMenuItem fixColumn = new DevExpress.Utils.Menu.DXSubMenuItem("Cố định cột");
            fixColumn.BeginGroup = true;
            Menu.Items.Add(fixColumn);

            var visbleColumns = this.VisibleColumns.Cast<GridColumn>();

            if (visbleColumns.Any(c => c.Fixed != FixedStyle.None))
            {
                DevExpress.Utils.Menu.DXMenuItem noFixColumn;
                noFixColumn = new DevExpress.Utils.Menu.DXMenuItem("Bỏ cố định cột");
                noFixColumn.Tag = menu.Column.AbsoluteIndex;
                noFixColumn.Click += new EventHandler(noFixColumn_Click);
                Menu.Items.Add(noFixColumn);
            }

            DevExpress.Utils.Menu.DXMenuItem fixLeftColumn;
            fixLeftColumn = new DevExpress.Utils.Menu.DXMenuItem("Về bên trái danh sách");
            fixLeftColumn.Tag = menu.Column.AbsoluteIndex;
            fixLeftColumn.Click += new EventHandler(fixLeftColumn_Click);
            fixColumn.Items.Add(fixLeftColumn);

            DevExpress.Utils.Menu.DXMenuItem fixRightColumn;
            fixRightColumn = new DevExpress.Utils.Menu.DXMenuItem("Về bên phải danh sách");
            fixRightColumn.Tag = menu.Column.AbsoluteIndex;
            fixRightColumn.Click += new EventHandler(fixRightColumn_Click);
            fixColumn.Items.Add(fixRightColumn);
            #endregion

            #region 5.1 Thêm cột tính toán
            DevExpress.Utils.Menu.DXMenuItem calcColumn;
            calcColumn = new DevExpress.Utils.Menu.DXMenuItem("Thêm cột tính toán");
            calcColumn.Tag = menu.Column.AbsoluteIndex;
            calcColumn.BeginGroup = true;
            calcColumn.Click += delegate(object sender, EventArgs e)
            {
                BandedGridColumn column = HelpBandedGridColumn.CreateBandedGridColumn(this, "Cột mới 1", this.Columns.Count + 1, 100);
                column.Visible = false;
                column.OptionsColumn.AllowEdit = false;
                column.OptionsColumn.ReadOnly = true;
                column.ShowUnboundExpressionMenu = true;

                //GridColumn column = getCotTinhToan();

                this.ShowUnboundExpressionEditor(column);
                if (column.UnboundExpression != String.Empty)
                {
                    InputBoxResult input = HelpMsgBox._showMsgInput("Vui lòng nhập vào chuỗi theo định dạng <Tên cột mới>;<Kiểu>. Với <Kiểu>:Văn bản, Số, Ngày, Logic\r\nVí dụ: Muốn tạo cột tên là Cột mới và kiểu là Văn bản thì nhập vào 'Cột mới;Văn bản'.");
                    if (input.ReturnCode == DialogResult.OK)
                    {
                        string caption = input.Text.Trim();
                        if (caption != String.Empty)
                        {
                            String[] captions = caption.Split(';');
                            captions[0] = captions[0].Trim();
                            column.FieldName = captions[0];
                            column.Caption = captions[0];
                            column.Visible = true;

                            if (captions.Length == 2)
                                captions[1] = captions[1].Trim();
                            if (captions[1] == "Văn bản")
                                column.UnboundType = DevExpress.Data.UnboundColumnType.String;
                            else if (captions[1] == "Văn bản")
                                column.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
                            else if (captions[1] == "Ngày")
                                column.UnboundType = DevExpress.Data.UnboundColumnType.DateTime;
                            else if (captions[1] == "Logic")
                                column.UnboundType = DevExpress.Data.UnboundColumnType.DateTime;
                            else
                                column.UnboundType = DevExpress.Data.UnboundColumnType.String;
                            return;
                        }
                        else
                        {
                            HelpMsgBox.ShowNotificationMessage("Tên cột mới không rỗng");
                        }
                    }
                }
                this.Columns.Remove(column);
            };
            Menu.Items.Add(calcColumn);

            if (Menu.Column.ShowUnboundExpressionMenu)
            {
                DXSubMenuItem itemXoa = new DXSubMenuItem("Bỏ cột tính toán");
                Menu.Items.Add(itemXoa);
                itemXoa.Click += delegate(object senderXoa, EventArgs eXoa)
                {
                    Menu.Column.Tag = "NO";
                    Menu.Column.Caption = "";
                    Menu.Column.Visible = false;

                    this.Columns.Remove(Menu.Column);
                };
            }

            #endregion

            #region 6. Export dữ liệu
             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 SimpleButton)
                {
                    if (((SimpleButton)_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 SimpleButton)
                {
                    if (((SimpleButton)_PrintElement).Visible == false)
                        isPrint = false;
                }
            }
            if (isPrint)
            { //Menu Print Data
                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 lưới
            if (_PLAutoWidth != null && _PLAutoWidth == false)
            {
                // Menu Display Data
                DevExpress.Utils.Menu.DXSubMenuItem itemGridLayout = new DevExpress.Utils.Menu.DXSubMenuItem("Tùy biến khác");
                itemGridLayout.BeginGroup = true;
                Menu.Items.Add(itemGridLayout);

                //Lưu hình dạng lưới như mặc định
                if (FrameworkParams.currentUser.username=="admin")
                {
                    DevExpress.Utils.Menu.DXMenuItem itemSaveLayOutDefault;
                    itemSaveLayOutDefault = new DevExpress.Utils.Menu.DXMenuItem("Lưu hình dạng danh sách như mặc định");
                    itemSaveLayOutDefault.BeginGroup = false;
                    itemSaveLayOutDefault.Click += new EventHandler(itemSaveLayOutDefault_Click);
                    itemGridLayout.Items.Add(itemSaveLayOutDefault);
                }

                //Lưu hình dạng lưới
                DevExpress.Utils.Menu.DXMenuItem itemSaveLayOut;
                itemSaveLayOut = new DevExpress.Utils.Menu.DXMenuItem("Lưu hình dạng danh sách");
                if (FrameworkParams.currentUser.username != "admin")
                    itemSaveLayOut.BeginGroup = false;
                else
                    itemSaveLayOut.BeginGroup = true;
                itemSaveLayOut.Click += new EventHandler(itemSaveLayOut_Click);
                itemGridLayout.Items.Add(itemSaveLayOut);

                //Phục hồi lại hình dạng ban đầu
                DevExpress.Utils.Menu.DXMenuItem itemResetLayOut;
                itemResetLayOut = new DevExpress.Utils.Menu.DXMenuItem("Xóa hình dạng danh sách đã lưu");
                itemResetLayOut.Click += new EventHandler(itemResetLayOut_Click);
                itemGridLayout.Items.Add(itemResetLayOut);

                //Phục hồi lại hình dạng ban đầu
                DevExpress.Utils.Menu.DXMenuItem itemScrollLayOut;
                itemScrollLayOut = new DevExpress.Utils.Menu.DXMenuItem("Điều chỉnh cột thủ công");
                itemScrollLayOut.Click += new EventHandler(itemScrollLayOut_Click);
                itemScrollLayOut.BeginGroup = true;
                itemGridLayout.Items.Add(itemScrollLayOut);

                DevExpress.Utils.Menu.DXMenuItem itemScrollLayOut1;
                itemScrollLayOut1 = new DevExpress.Utils.Menu.DXMenuItem("Điều chỉnh cột tự động");
                itemScrollLayOut1.Click += new EventHandler(itemScrollLayOut1_Click);
                itemGridLayout.Items.Add(itemScrollLayOut1);
            }
            #endregion

            #region 9. Hỗ trợ Debug
            if (FrameworkParams.isSupportDeveloper == true)
            {
                // Menu Display Data
                DevExpress.Utils.Menu.DXSubMenuItem itemDebug = new DevExpress.Utils.Menu.DXSubMenuItem("Debug");
                itemDebug.BeginGroup = true;
                Menu.Items.Add(itemDebug);

                DevExpress.Utils.Menu.DXMenuItem itemDebug01 = new DevExpress.Utils.Menu.DXMenuItem("Xem toàn bộ dữ liệu");
                itemDebug01.Tag = menu.Column.AbsoluteIndex;
                itemDebug01.Click += new EventHandler(itemDebug01_Click);
                itemDebug.Items.Add(itemDebug01);

                DevExpress.Utils.Menu.DXMenuItem itemDebug02 = new DevExpress.Utils.Menu.DXMenuItem("Xem toàn bộ dữ liệu và cấu trúc danh sách");
                itemDebug02.Tag = menu.Column.AbsoluteIndex;
                itemDebug02.Click += new EventHandler(itemDebug02_Click);
                itemDebug.Items.Add(itemDebug02);

            }
            #endregion
        }
Пример #28
0
 // Create a submenu with a single DeleteRow item.
 DXMenuItem CreateRowSubMenu(GridView view, int rowHandle)
 {
     var subMenu = new DXSubMenuItem("Chọn");
     var menuItemEditRow = new DXMenuItem("&Sửa", new EventHandler(OnDeleteRowClick), imageCollection1.Images[58]) {Tag = new RowInfo(view, rowHandle)};
     var menuItemDeleteRow = new DXMenuItem("&Xóa", new EventHandler(OnDeleteRowClick), imageCollection1.Images[36]) { Tag = new RowInfo(view, rowHandle) };
     subMenu.Items.Add(menuItemEditRow);
     subMenu.Items.Add(menuItemDeleteRow);
     return subMenu;
 }
Пример #29
0
        private void pivotGridControl1_ShowMenu(object sender, DevExpress.XtraPivotGrid.PivotGridMenuEventArgs e)
        {
            var pivoFfield = e.Field;

            #region  TODO: temp nousing customize

            //DXMenuItem itemTotal = new DXMenuItem();
            //if (pivoFfield.TotalsVisibility == PivotTotalsVisibility.None)
            //{
            //    itemTotal.Caption = "Hiện total (tổng)";
            //    itemTotal.Tag = PivotTotalsVisibility.AutomaticTotals;
            //}
            //else
            //{
            //    itemTotal.Caption = "Ẩn total (tổng)";
            //    itemTotal.Tag = PivotTotalsVisibility.None;
            //}
            //itemTotal.Click += delegate(object senderr, EventArgs re)
            //{
            //    pivoFfield.TotalsVisibility = (PivotTotalsVisibility)itemTotal.Tag;
            //};

            //DXMenuCheckItem itemNoOrder = new DXMenuCheckItem("Không sắp xếp");
            //itemNoOrder.Checked = pivoFfield.SortMode == PivotSortMode.None;

            //DXMenuCheckItem itemAsc = new DXMenuCheckItem("Sắp tăng dần");
            //itemAsc.Checked = pivoFfield.SortMode != PivotSortMode.None && pivoFfield.SortOrder == PivotSortOrder.Ascending;

            //DXMenuCheckItem itemDesc = new DXMenuCheckItem("Sắp giảm dần");
            //itemDesc.Checked = pivoFfield.SortMode != PivotSortMode.None && pivoFfield.SortOrder == PivotSortOrder.Descending;

            //itemNoOrder.CheckedChanged += delegate(object sendere, EventArgs ee)
            //{

            //    pivoFfield.SortMode = PivotSortMode.None;

            //};

            //itemAsc.CheckedChanged += delegate(object sendere, EventArgs ee)
            //{
            //    pivoFfield.SortMode = PivotSortMode.Value;
            //    pivoFfield.SortOrder = PivotSortOrder.Ascending;

            //};

            //itemDesc.CheckedChanged += delegate(object sendere, EventArgs ee)
            //{
            //    pivoFfield.SortMode = PivotSortMode.Value;
            //    pivoFfield.SortOrder = PivotSortOrder.Descending;

            //};

            #endregion

            if (pivoFfield == null)
            {
                if (e.HitInfo != null && e.HitInfo.ValueInfo != null)
                {
                    pivoFfield = e.HitInfo.ValueInfo.DataField;
                }
            }

            #region data field Menu

            if (pivoFfield != null)
            {

                #region DataArea Menu

                if (pivoFfield.Area == PivotArea.DataArea)
                {
                    var subMenuSummaryTpe = new DXSubMenuItem("Kiểu thống kê");
                    foreach (PivotSummaryType sumaryType in Enum.GetValues(typeof (PivotSummaryType)))
                    {
                        string caption;
                        switch (sumaryType)
                        {
                            case PivotSummaryType.Sum:
                                caption = "Tổng";
                                break;
                            case PivotSummaryType.Count:
                                caption = "Đếm";
                                break;
                            case PivotSummaryType.Average:
                                caption = "Trung bình";
                                break;
                            case PivotSummaryType.Min:
                                caption = "Nhỏ nhất";
                                break;
                            case PivotSummaryType.Max:
                                caption = "Lớn nhất";
                                break;
                            default:
                                continue;
                        }
                        var item = new DXMenuCheckItem(caption)
                                       {Tag = sumaryType, Checked = pivoFfield.SummaryType== sumaryType};

                        item.CheckedChanged += delegate(object senderr, EventArgs ee)
                                                   {
                                                       var it = (DXMenuCheckItem) senderr;
                                                       var type = (PivotSummaryType) it.Tag;
                                                       pivoFfield.SummaryType = type;
                                                       ;
                                                   };
                        subMenuSummaryTpe.Items.Add(item);
                    }
                    subMenuSummaryTpe.BeginGroup = true;
                    e.Menu.Items.Add(subMenuSummaryTpe);
                }

                #endregion
            }

            #endregion

            #region Common menu

            var itemSaveLayout = new DXMenuItem("Lưu hình dạng lưới");
            var itemDeleteLayout = new DXMenuItem("Xóa hình dạng lưới đã lưu");
            itemSaveLayout.Click += delegate(object senderr, EventArgs ee)
                                        {
                                            try
                                            {
                                                pivotGridControl1.SaveLayoutToXml(PivotLayoutName);
                                            }
                                            catch
                                            {
                                            }
                                        };
            itemDeleteLayout.Click += delegate(object senderr, EventArgs ee)
                                          {
                                              try
                                              {
                                                  string f = PivotLayoutName;
                                                  if (File.Exists(f)) File.Delete(f);
                                                  pivotGridControl1.ResumeLayout(true);

                                                  pivotGridControl1.BestFit();
                                              }
                                              catch
                                              {
                                              }
                                          };
            var itemsCount = e.Menu.Items.Count;
            if (itemsCount > 0)
            {
                itemSaveLayout.BeginGroup = true;
            }
            e.Menu.Items.Add(itemSaveLayout);
            e.Menu.Items.Add(itemDeleteLayout);

            #endregion
        }
Пример #30
0
 /// <summary>
 ///     Добавить новую кнопку в контекстное меню
 /// </summary>
 /// <param name="dxsmi">Кнопка меню, к которой нужно добавить кнопку</param>
 /// <param name="name">Название кнопки</param>
 /// <param name="click">Обработчик нажатия</param>
 /// <param name="tag">Tag</param>
 /// <param name="glyph">Изображение на кнопке</param>
 private static void AddBarButton(DXSubMenuItem dxsmi, string name, EventHandler click, object tag = null, Bitmap glyph = null)
 {
     var addBarButton = new DXMenuItem
     {
         Caption = name,
         Image = glyph,
         Tag = tag
     };
     addBarButton.Click += click;
     dxsmi.Items.Add(addBarButton);
 }
Пример #31
0
 public static DXMenuItem CreateRowSubMenu(GridView view, int rowHandle)
 {
     m_grv = view;
     DXSubMenuItem subMenu = new DXSubMenuItem("Báo cáo");
     DXMenuItem menuItemReportXLS = new DXMenuItem("&Báo cáo XLS", new EventHandler(ExportXLSClick));
     DXMenuItem menuItemReportPDF = new DXMenuItem("&Báo cáo PDF", new EventHandler(ExportPDFClick));
     DXMenuItem menuItemReportHTML = new DXMenuItem("&Báo cáo HTML", new EventHandler(ExportHTMLClick));
     DXMenuItem menuItemReportDOC = new DXMenuItem("&Báo cáo TXT", new EventHandler(ExportDOCClick));
     subMenu.Items.Add(menuItemReportXLS);
     subMenu.Items.Add(menuItemReportPDF);
     subMenu.Items.Add(menuItemReportHTML);
     subMenu.Items.Add(menuItemReportDOC);
     return subMenu;
 }
Пример #32
0
 private static DXMenuItem CreatePrintingMenu(GridView view, int rowHandle)
 {
     DXSubMenuItem subMenu = new DXSubMenuItem("Print");
     DXMenuItem menuItemPrinting = new DXMenuItem("&Preview", new EventHandler(onPrintingClick), BrightVision.Common.Resources.printer);
     menuItemPrinting.Tag = new RowInfo(view, rowHandle);
     subMenu.Items.Add(menuItemPrinting);
     return subMenu;
 }
Пример #33
0
 private static DXMenuItem CreateExportMenu(GridView view, int rowHandle)
 {
     DXSubMenuItem subMenu = new DXSubMenuItem("Export");
     DXMenuItem menuItemExport = new DXMenuItem("&Excel Workbook (*.xls)", new EventHandler(OnExportToExcelClick), BrightVision.Common.Resources.export_xls);
     menuItemExport.Tag = new RowInfo(view, rowHandle, ViewExportType.Excel2003);
     subMenu.Items.Add(menuItemExport);
     menuItemExport = new DXMenuItem("E&xcel Workbook (*.xlsx)", new EventHandler(OnExportToExcelClick), BrightVision.Common.Resources.export_excel);
     menuItemExport.Tag = new RowInfo(view, rowHandle, ViewExportType.Excel2007);
     subMenu.Items.Add(menuItemExport);
     menuItemExport = new DXMenuItem("&CSV (Comma Delimited) (*.csv)", new EventHandler(OnExportToExcelClick), BrightVision.Common.Resources.export_csv);
     menuItemExport.Tag = new RowInfo(view, rowHandle, ViewExportType.CSV);
     subMenu.Items.Add(menuItemExport);
     return subMenu;
 }
Пример #34
0
        private void grwCustomerList_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e)
        {

            if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Row)
            {
                GridViewMenu menu = e.Menu as GridViewMenu;

                menu.Items.Clear();

                DXMenuItem itemReload = new DXMenuItem("Nạp lại"); // caption menu
                itemReload.Image = ImgCollection.Images["refresh2_16x16.png"]; // icon cho menu
                itemReload.Shortcut = Shortcut.F5; // phím tắt
                itemReload.Click += new EventHandler(itemReload_Click);// thêm sự kiện click
                menu.Items.Add(itemReload);

                DXMenuItem itemAdd = new DXMenuItem("Thêm");
                itemAdd.BeginGroup = true;
                itemAdd.Image = ImgCollection.Images["new_16x16.png"];
                itemAdd.Shortcut = Shortcut.CtrlN;
                itemAdd.Click += new EventHandler(itemAdd_Click);
                menu.Items.Add(itemAdd);

                DXMenuItem itemEdit = new DXMenuItem("Sửa");
                itemEdit.Image = ImgCollection.Images["edit_16x16.png"];
                itemEdit.Shortcut = Shortcut.CtrlE;
                itemEdit.Click += new EventHandler(itemEdit_Click);
                menu.Items.Add(itemEdit);

                DXMenuItem itemDelete = new DXMenuItem("Xóa");
                itemDelete.Image = ImgCollection.Images["delete_16x16.png"];
                itemDelete.Shortcut = Shortcut.CtrlDel;
                itemDelete.Click += new EventHandler(itemDelete_Click);
                menu.Items.Add(itemDelete);

                // add submenu
                DXSubMenuItem sItem = new DXSubMenuItem("SubMenu");
                sItem.Items.Add(new DXMenuItem("1"));
                sItem.Items.Add(new DXMenuItem("2"));
                menu.Items.Add(sItem);

            }
        }
Пример #35
0
        private void GridPopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
        {
            if (e.MenuType == GridMenuType.Column)
            {
                string[] columns =
                {
                    GridLocalizer.Active.GetLocalizedString(GridStringId.MenuColumnGroup),
                    GridLocalizer.Active.GetLocalizedString(GridStringId.MenuGroupPanelShow)
                };

                foreach (DXMenuItem item in e.Menu.Items)
                {
                    if (columns.Contains(item.Caption))
                    {
                        item.Visible = false;
                    }
                }
            }

            var col = e.HitInfo.Column;

            if (col == null)
            {
                return;
            }

            if (e.MenuType == GridMenuType.Column)
            {
                if (col.Caption == Resources.Selection || col.Caption == Resources.Progress)
                {
                    return;
                }

                string colName = (col.Fixed == FixedStyle.None) ? "Freeze Column" : "Unfreeze Column";
                e.Menu.Items.Add(new DXMenuItem(colName, ChangeFixedColumnStyle, Resources.IconLeftCol)
                {
                    Tag = col.FieldName
                });

                if (view.Editable)
                {
                    e.Menu.Items.Add(new DXMenuItem("Restore Default Layout", RestoreDefaultLayout, Resources.IconRestoreLayout));
                }
            }
            else if (e.MenuType == GridMenuType.Row)
            {
                if (col.Caption == Resources.Selection || col.Caption == Resources.Progress)
                {
                    return;
                }

                if (view.OptionsBehavior.Editable)
                {
                    DXSubMenuItem ci = new DXSubMenuItem("Change Fix Action");
                    ci.ImageOptions.Image = Resources.IconReplace;
                    e.Menu.Items.Add(ci);

                    ci.Items.Add(new DXMenuItem(IndexOp.REBUILD.Description(), ChangeFixAction, Resources.IconIndexes));
                    ci.Items.Add(new DXMenuItem(IndexOp.REORGANIZE.Description(), ChangeFixAction, Resources.IconIndexes));

                    if (Settings.ServerInfo.IsCompressionAvailable)
                    {
                        ci.Items.Add(new DXMenuItem(IndexOp.REBUILD_ROW.Description(), ChangeFixAction, Resources.IconIndexes)
                        {
                            BeginGroup = true
                        });
                        ci.Items.Add(new DXMenuItem(IndexOp.REBUILD_PAGE.Description(), ChangeFixAction, Resources.IconIndexes));
                        ci.Items.Add(new DXMenuItem(IndexOp.REBUILD_NONE.Description(), ChangeFixAction, Resources.IconIndexes));
                    }

                    if (Settings.ServerInfo.IsOnlineRebuildAvailable)
                    {
                        ci.Items.Add(new DXMenuItem(IndexOp.REBUILD_ONLINE.Description(), ChangeFixAction, Resources.IconIndexes));
                    }

                    if (Settings.ServerInfo.IsColumnstoreAvailable)
                    {
                        ci.Items.Add(new DXMenuItem(IndexOp.REBUILD_COLUMNSTORE.Description(), ChangeFixAction, Resources.IconIndexes)
                        {
                            BeginGroup = true
                        });
                        ci.Items.Add(new DXMenuItem(IndexOp.REBUILD_COLUMNSTORE_ARCHIVE.Description(), ChangeFixAction, Resources.IconIndexes));

                        if (Settings.ServerInfo.MajorVersion >= ServerVersion.Sql2016)
                        {
                            ci.Items.Add(new DXMenuItem(IndexOp.CREATE_COLUMNSTORE_INDEX.Description(), ChangeFixAction, Resources.IconReplace));
                        }
                    }

                    ci.Items.Add(new DXMenuItem(IndexOp.UPDATE_STATISTICS_FULL.Description(), ChangeFixAction, Resources.IconUpdateStats)
                    {
                        BeginGroup = true
                    });
                    ci.Items.Add(new DXMenuItem(IndexOp.UPDATE_STATISTICS_RESAMPLE.Description(), ChangeFixAction, Resources.IconUpdateStats));
                    ci.Items.Add(new DXMenuItem(IndexOp.UPDATE_STATISTICS_SAMPLE.Description(), ChangeFixAction, Resources.IconUpdateStats));

                    ci.Items.Add(new DXMenuItem(IndexOp.TRUNCATE_TABLE.Description(), ChangeFixAction, Resources.IconClear)
                    {
                        BeginGroup = true
                    });
                    ci.Items.Add(new DXMenuItem(IndexOp.DISABLE_INDEX.Description(), ChangeFixAction, Resources.IconHide));
                    ci.Items.Add(new DXMenuItem(IndexOp.DROP_TABLE.Description(), ChangeFixAction, Resources.IconDelete));

                    ci.Items.Add(new DXMenuItem(IndexOp.SKIP.Description(), ChangeFixAction, Resources.IconSkip)
                    {
                        BeginGroup = true
                    });
                }

                e.Menu.Items.Add(new DXMenuItem("Copy Fix Script", CopyFixScript, Resources.IconCopyFix));
                e.Menu.Items.Add(new DXMenuItem("Copy Value", CopyCellValue, Resources.IconCopy)
                {
                    Tag = col.FieldName
                });
                e.Menu.Items.Add(new DXMenuItem("Filter Value", FilterCellValue, Resources.IconFilter)
                {
                    Tag = col.FieldName
                });

                if (view.OptionsBehavior.Editable)
                {
                    string[] columns =
                    {
                        Resources.DatabaseName,
                        Resources.SchemaName,
                        Resources.ObjectName,
                        Resources.IndexName
                    };

                    if (columns.Contains(col.FieldName))
                    {
                        e.Menu.Items.Add(new DXMenuItem("Exclude Value", HideCellValue, Resources.IconHide)
                        {
                            Tag = col.FieldName
                        });
                    }
                }
            }
        }
Пример #36
0
        /// <summary>
        /// Добавить в меню пункты по выбору способа выделения ячеек
        /// </summary>
        /// <param name="menu">Меню</param>
        /// <param name="selectCustom">Метод для обработки случая выборки нескольких ячеек</param>
        /// <param name="selectRow">Метод для обработки случая выборки нескольких строк</param>
        /// <param name="selectRows">Метод для обработки случая выборки одной строки</param>
        public static void DXCreateSelectSelectionMenu(DXPopupMenu menu, EventHandler selectCustom, EventHandler selectRow, EventHandler selectRows)
        {
            var dxsmiSelect = new DXSubMenuItem("Способы выделения ячеек")
            {
                Image = Resources.table_select
            };
            var dxmiSelectRows = new DXMenuItem("Колонка для выделения")
            {
                Image = Resources.check_box_list
            };
            var dxmiSelectCustom = new DXMenuItem("Выделение нескольких ячеек")
            {
                Image = Resources.table_select_group
            };
            var dxmiSelectRow = new DXMenuItem("Выделение строк")
            {
                Image = Resources.table_select_row
            };

            dxmiSelectCustom.Click += selectCustom;
            dxmiSelectRow.Click += selectRow;
            dxmiSelectRows.Click += selectRows;

            dxsmiSelect.Items.Add(dxmiSelectRow);
            dxsmiSelect.Items.Add(dxmiSelectRows);
            dxsmiSelect.Items.Add(dxmiSelectCustom);

            menu.Items.Add(dxsmiSelect);
        }
Пример #37
0
 public void AddSubMenuItem(DXSubMenuItem Item)
 {
     SubMenuItems.Add(Item);
 }
Пример #38
0
 /// <summary>
 /// Скрыть стандартные кнопки из меню Грида
 /// </summary>
 private static void HideCustomizationColumns(DXSubMenuItem menu)
 {
     var showColumns = menu.Items
         .Cast<DXMenuItem>()
         .FirstOrDefault(i => i.Tag is TreeListStringId && (TreeListStringId)i.Tag == TreeListStringId.MenuColumnColumnCustomization);
     if (showColumns != null)
         showColumns.Visible = false;
 }
Пример #39
0
        /// <summary>
        /// BuildFieldPopupMenu
        /// </summary>
        /// <param name="e"></param>

        void BuildFieldPopupMenu(
            PopupMenuShowingEventArgs e)
        {
            PivotArea     area      = (PivotArea)(-1);
            string        areaName  = "";
            Image         areaImage = null;
            DXSubMenuItem smi;

            PivotGridFieldContext f = GetPivotGridFieldContext(e.Field);

            if (f == null)
            {
                return;
            }
            PivotGridField = f.F;             // save as current field

            ResultsField rfld = f.ResultsField;
            QueryColumn  qc   = f.Qc;

            GetFieldAreaAttributes(e, out area, out areaName, out areaImage);

            DXPopupMenu dxpMenu = e.Menu;             // clear dest menu

            dxpMenu.Items.Clear();

            AggregationDefMenus ats = new AggregationDefMenus();             // used to build menus

            // Build DataArea summary type items

            if (area == PivotArea.DataArea)
            {
                ContextMenuStrip modelMenu = ats.SetupAggregationTypeMenu(qc, f.Aggregation, null, includeGroupingItems: false, includeSummaryItems: true);
                ConvertAndAppendContextMenuStripToDxPopupMenu(modelMenu, dxpMenu);
            }

            // Build ColumnArea or RowArea Grouping items

            if (area == PivotArea.ColumnArea || area == PivotArea.RowArea)
            {
                ContextMenuStrip modelMenu = ats.SetupAggregationTypeMenu(qc, f.Aggregation, null, includeGroupingItems: true, includeSummaryItems: false);
                ConvertAndAppendContextMenuStripToDxPopupMenu(modelMenu, dxpMenu);
            }

            if (dxpMenu.Items.Count == 0)             // just add to menu if nothing there so far
            {
                smi = dxpMenu;
            }

            else             // add to submenu
            {
                smi            = new DXSubMenuItem("Move Field to");
                smi.BeginGroup = true;
                dxpMenu.Items.Add(smi);
            }

            smi.Items.Add(new DXMenuCheckItem("Column Area", area == PivotArea.ColumnArea, Bitmaps16x16.Images[0], ColumnAreaMenuItem_Click));
            smi.Items.Add(new DXMenuCheckItem("Row Area", area == PivotArea.RowArea, Bitmaps16x16.Images[1], RowAreaMenuItem_Click));
            smi.Items.Add(new DXMenuCheckItem("Data Area", area == PivotArea.DataArea, Bitmaps16x16.Images[2], DataAreaMenuItem_Click));
            smi.Items.Add(new DXMenuCheckItem("Filter Area", area == PivotArea.FilterArea, Bitmaps16x16.Images[3], FilterAreaMenuItem_Click));
            smi.Items.Add(new DXMenuCheckItem("None", area == (PivotArea)(-1), null, UnassignedAreaMenuItem_Click));

            return;
        }
Пример #40
0
        public static void AddFontAndColortoPopupMenuShowing(object sender, PopupMenuShowingEventArgs e, GridControl gridcontrol, string FormName)
        {
            //nếu sử dụng thì tích hợp save layout.
            if (e.MenuType == GridMenuType.Column)
            {
                GridViewColumnMenu menu = e.Menu as GridViewColumnMenu;
                //menu.Items.Clear();
                if (menu.Column != null)
                {
                    // font chữ

                    DXMenuCheckItem font = new DXMenuCheckItem("Fonts", true, Properties.Resources.font_16, new EventHandler(OnFixedClick));
                    font.Tag = new MenuInfo(menu.Column, FixedStyle.None);
                    menu.Items.Add(font);

                    // Màu nền
                    DXSubMenuItem sItem = new DXSubMenuItem("Back Ground");
                    sItem.ImageOptions.Image = Properties.Resources.background;
                    Color mauhong   = ColorTranslator.FromHtml("#FFC2BE");
                    Color mauxanh   = ColorTranslator.FromHtml("#A8D5FF");
                    Color xanhduong = ColorTranslator.FromHtml("#C1F49C");
                    Color mauvang   = ColorTranslator.FromHtml("#FEF7A5");
                    Color mautim    = ColorTranslator.FromHtml("#E0CFE9");
                    Color xanhlam   = ColorTranslator.FromHtml("#8DE9DF");
                    Color mautrang  = ColorTranslator.FromHtml("#FFFFFF");
                    Color mauden    = ColorTranslator.FromHtml("#000000");

                    sItem.Items.Add(CreateCheckItem("Color White", menu.Column, FixedStyle.None, mautrang));
                    sItem.Items.Add(CreateCheckItem("Color Black", menu.Column, FixedStyle.None, mauden));
                    sItem.Items.Add(CreateCheckItem("Color Pink", menu.Column, FixedStyle.None, mauhong));
                    sItem.Items.Add(CreateCheckItem("Color Blue", menu.Column, FixedStyle.None, mauxanh));
                    sItem.Items.Add(CreateCheckItem("Color Green", menu.Column, FixedStyle.None, xanhduong));
                    sItem.Items.Add(CreateCheckItem("Color Yellow", menu.Column, FixedStyle.None, mauvang));
                    sItem.Items.Add(CreateCheckItem("Color Purple", menu.Column, FixedStyle.None, mautim));
                    sItem.Items.Add(CreateCheckItem("Color Cyan", menu.Column, FixedStyle.None, xanhlam));

                    sItem.Items.Add(CreateCheckItem("Color Customize...", menu.Column, FixedStyle.None, Color.Transparent));
                    menu.Items.Add(sItem);

                    // màu chữ
                    var mauchu = new DXSubMenuItem("Fore Color");
                    mauchu.ImageOptions.Image = Properties.Resources.forcolor;
                    Color Red        = Color.Red;
                    Color pink       = ColorTranslator.FromHtml("#E91E63");
                    Color purple     = ColorTranslator.FromHtml("#9C27B0");
                    Color DeepPurple = ColorTranslator.FromHtml("#673AB7");
                    Color Indigo     = ColorTranslator.FromHtml("#E0CFE9");
                    Color blue       = ColorTranslator.FromHtml("#3F51B5");
                    Color cyan       = ColorTranslator.FromHtml("#00BCD4");
                    Color Teal       = ColorTranslator.FromHtml("#009688");
                    Color green      = ColorTranslator.FromHtml("#4CAF50");
                    Color Lime       = ColorTranslator.FromHtml("#CDDC39");
                    Color Amber      = ColorTranslator.FromHtml("#FFC107");
                    Color Orange     = ColorTranslator.FromHtml("#FF9800");
                    Color depOrange  = ColorTranslator.FromHtml("#FF5722");
                    Color brown      = ColorTranslator.FromHtml("#795548");
                    Color grey       = ColorTranslator.FromHtml("#9E9E9E");
                    Color BlueGrey   = ColorTranslator.FromHtml("#607D8B");
                    Color Black      = ColorTranslator.FromHtml("#000000");
                    Color White      = ColorTranslator.FromHtml("#FFFFFF");

                    mauchu.Items.Add(CreateCheckItem("Black", menu.Column, FixedStyle.None, Black));
                    mauchu.Items.Add(CreateCheckItem("White", menu.Column, FixedStyle.None, White));
                    mauchu.Items.Add(CreateCheckItem("Pink", menu.Column, FixedStyle.None, pink));
                    mauchu.Items.Add(CreateCheckItem("Purple", menu.Column, FixedStyle.None, purple));
                    mauchu.Items.Add(CreateCheckItem("Deep Purple", menu.Column, FixedStyle.None, DeepPurple));
                    mauchu.Items.Add(CreateCheckItem("Indigo", menu.Column, FixedStyle.None, Indigo));
                    // mauchu.Items.Add(CreateCheckItem("Red", menu.Column, FixedStyle.None, Red));
                    mauchu.Items.Add(CreateCheckItem("Blue", menu.Column, FixedStyle.None, blue));
                    mauchu.Items.Add(CreateCheckItem("Cyan", menu.Column, FixedStyle.None, cyan));
                    mauchu.Items.Add(CreateCheckItem("Teal", menu.Column, FixedStyle.None, Teal));
                    mauchu.Items.Add(CreateCheckItem("Green", menu.Column, FixedStyle.None, green));
                    mauchu.Items.Add(CreateCheckItem("Lime", menu.Column, FixedStyle.None, Lime));
                    mauchu.Items.Add(CreateCheckItem("Amber", menu.Column, FixedStyle.None, Amber));
                    mauchu.Items.Add(CreateCheckItem("Orange", menu.Column, FixedStyle.None, Orange));
                    mauchu.Items.Add(CreateCheckItem("Deep Orange", menu.Column, FixedStyle.None, depOrange));
                    mauchu.Items.Add(CreateCheckItem("Brown", menu.Column, FixedStyle.None, brown));
                    mauchu.Items.Add(CreateCheckItem("Grey", menu.Column, FixedStyle.None, grey));
                    mauchu.Items.Add(CreateCheckItem("Blue Grey", menu.Column, FixedStyle.None, BlueGrey));

                    mauchu.Items.Add(CreateCheckItem("ForeColor Customize...", menu.Column, FixedStyle.None, Color.Transparent));
                    menu.Items.Add(mauchu);

                    DXMenuCheckItem save_layout = new DXMenuCheckItem("Save Layout", true);
                    save_layout.ImageOptions.Image = Properties.Resources.save;
                    save_layout.CheckedChanged    += (ss, ee) =>
                    {
                        var path = TEMP_PATH + "\\" + FormName + "\\" + gridcontrol.Name + "\\custom_layout.xml";
                        gridcontrol.MainView.SaveLayoutToXml(path, OptionsLayoutBase.FullLayout);
                        //FrmMain.Instance.ShowMessageInfo("Đã lưu cấu hình layout.");
                    };
                    DXMenuCheckItem reset_layout = new DXMenuCheckItem("Reset Layout", true);
                    reset_layout.CheckedChanged += (ss, ee) =>
                    {
                        var path        = TEMP_PATH + "\\" + FormName + "\\" + gridcontrol.Name + "\\default_layout.xml";
                        var path_custom = TEMP_PATH + "\\" + FormName + "\\" + gridcontrol.Name + "\\custom_layout.xml";
                        if (File.Exists(path))
                        {
                            gridcontrol.MainView.RestoreLayoutFromXml(path, OptionsLayoutBase.FullLayout);
                            //FrmMain.Instance.ShowMessageInfo("Reset layout thành công.");
                        }

                        if (File.Exists(path_custom))
                        {
                            File.Delete(path_custom);
                        }
                    };
                    reset_layout.ImageOptions.Image = Properties.Resources.reset_16x16;
                    menu.Items.Add(save_layout);
                    menu.Items.Add(reset_layout);
                }
            }
        }
Пример #41
0
        private void DXCreateLayoutMenuItems()
        {
            var ribeNewStateName = new RepositoryItemButtonEdit
            {
                AutoHeight = false,
                NullText = @"Введите имя"
            };
            ribeNewStateName.Buttons.Clear();
            ribeNewStateName.Buttons.Add(new EditorButton(ButtonPredefines.Glyph)
            {
                Image = Resources.save,
                ToolTip = "Сохранить состояние с введённым именем"
            });
            var dxmeNewLayout = new DXEditMenuItem
            {
                Image = Resources.layout_add,
                Edit = ribeNewStateName,
                Width = 100
            };
            var dxdmiNewState = new DXSubMenuItem("Сохранить состояние")
            {
                BeginGroup = true,
                Image = Resources.saveas
            };
            var dxmiDefaultState = new DXMenuItem("Начальное состояние")
            {
                Image = Resources.layout_default
            };
            var dxmiLastState = new DXMenuItem("Последнее сохранённое")
            {
                Image = Resources.layout_link
            };

            //Создаём обработчики событий для меню
            menu.BeforePopup += BeforePopupMenuLayout;
            ribeNewStateName.ButtonClick += NewStateNameButtonClick;
            bbiDeleteStates.Click += DeleteStatesItemClick;
            dxmiDefaultState.Click += DefaultStateItemClick;
            dxmiLastState.Click += LastStateItemClick;

            //Распределяем кнопки по меню
            dxdmiNewState.Items.Add(dxmeNewLayout);
            menu.Items.Add(dxdmiNewState);
            menu.Items.Add(dxsmiSaved);
            menu.Items.Add(dxsmiRemove);
            menu.Items.Add(dxmiDefaultState);
            menu.Items.Add(dxmiLastState);
        }