private void gridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e)
 {
     if (e.MenuType != DevExpress.XtraGrid.Views.Grid.GridMenuType.Summary)
     {
         return;
     }
     DevExpress.XtraGrid.Menu.GridViewFooterMenu footerMenu = e.Menu as DevExpress.XtraGrid.Menu.GridViewFooterMenu;
     DevExpress.Utils.Menu.DXMenuItem            menuItem   = new DevExpress.Utils.Menu.DXMenuItem("MyItem", new EventHandler(MyMenuItem));
     menuItem.Tag = e.Menu;
     footerMenu.Items.Add(menuItem);
 }
Exemple #2
0
        private void gridView_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e)
        {
            //------------------------------------------------------------------------------------------------------------//

            //这段代码是我专用于给xtrGrid加一个点中空地方时显示的菜单,我在这里加入了它的打印功能
            if (e.Menu == null)
            {
                /*
                 *  if(e.HitInfo.InRow == false && (sender is DevExpress.XtraGrid.Views.Grid.GridView))
                 *  {
                 *   gCExport = ((DevExpress.XtraGrid.Views.Grid.GridView)sender).GridControl;
                 *   Point pt = e.Point;
                 *   pt.X = pt.X + gCExport.Location.X;
                 *   pt.Y = pt.Y + gCExport.Location.Y;
                 *   popupMenu1.ShowPopup(gCExport.PointToScreen(pt));
                 *  }
                 *
                 */
                return;
            }

            //------------------------------------------------------------------------------------------------------------//
            //汉化xtraGrid的菜单
            System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuFooterSum, "总和");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuFooterMin, "最小值");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuFooterMax, "最大值");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuFooterCount, "数量");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuFooterAverage, "平均值");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuFooterNone, "无");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnSortAscending, "上升排序");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnSortDescending, "下降排序");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnGroup, "分组");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnUnGroup, "取消分组");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnColumnCustomization, "自定义");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnBestFit, "最佳宽度");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnFilter, "过滤");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnClearFilter, "清除过滤");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnBestFitAllColumns, "所有列最佳宽度");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuGroupPanelFullExpand, "全部展开");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuGroupPanelFullCollapse, "全部收缩");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuGroupPanelClearGrouping, "清除分组");
            ld.Add(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnGroupBox, "窗口式分组");

            foreach (DevExpress.Utils.Menu.DXMenuItem item in e.Menu.Items)
            {
                Object val = ld[item.Tag];
                if (val != null)
                {
                    item.Caption = val.ToString();
                }
            }
        }
 private void gridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e)
 {
     if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Column && e.HitInfo.InGroupColumn && e.HitInfo.Column.FieldName == "A")
     {
         foreach (DevExpress.Utils.Menu.DXMenuItem item in e.Menu.Items)
         {
             if (item.Caption == DevExpress.XtraGrid.Localization.GridLocalizer.Active.GetLocalizedString(DevExpress.XtraGrid.Localization.GridStringId.MenuColumnUnGroup))
             {
                 item.Enabled = false;
             }
         }
     }
 }
 private void bandedGridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e)
 {
     if (e.Menu != null)
     {
         if (e.Menu.Items != null)
         {
             foreach (DXMenuItem _menu in e.Menu.Items)
             {
                 _menu.Enabled = true;
             }
         }
     }
 }
Exemple #5
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);
        }
Exemple #6
0
 private void gridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e)
 {
     if (!e.HitInfo.InRowCell)
     {
         return;
     }
     if (!ContainsComment(e.HitInfo.Column.Name, gridView1.GetDataSourceRowIndex(e.HitInfo.RowHandle)))
     {
         DXMenuItem insertItem = new DXMenuItem("Insert Comment");
         e.Menu.Items.Add(insertItem);
         insertItem.Tag    = e.Point;
         insertItem.Click += new EventHandler(insertItem_Click);
     }
     else
     {
         DXMenuItem editItem = new DXMenuItem("Edit Comment");
         e.Menu.Items.Add(editItem);
         editItem.Tag    = e.Point;
         editItem.Click += new EventHandler(editItem_Click);
     }
 }
Exemple #7
0
 private void gridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e)
 {
     popupMappedPhrases.ShowPopup(gridControlMappedPhrases.PointToScreen(e.Point));
 }