private void RefreshBtn_Click(object sender, EventArgs e)
        {
            _RangeSelector.BringToFront();
            _RangeSelector.Location         = new Point(20, 20);
            _RangeSelector.DtFrom.EditValue = GlobalVariables.FinYearStartDate;
            _RangeSelector.DtEnd.EditValue  = GlobalVariables.FinYearEndDate;

            _RangeSelector.Show();
            _RangeSelector.DtFrom.Focus();
        }
        private void MasterGridView_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e)
        {
            try
            {
                e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Select Report Data Range", (o1, e1) =>
                {
                    Controls.Add(_RangeSelector);
                    _RangeSelector.BtnLoad.Click += new EventHandler(BtnLoad_Click);
                    _RangeSelector.BringToFront();
                    _RangeSelector.Location = new Point(e.Point.X + 20, e.Point.Y + 20);
                    _RangeSelector.Show();
                    _RangeSelector.DtFrom.Focus();
                }));



                var formatRulesMenu = new DXPopupMenu();
                var view            = sender as GridView;

                DXMenuItem Copy;


                DXMenuItem SAR;



                DXMenuItem Collapse;
                DXMenuItem Expand;
                DXMenuItem FixLeft;
                DXMenuItem FixRight;
                DXMenuItem UnFix;


                Copy = new DXMenuItem("Copy", (o1, e1) =>
                {
                    view.OptionsSelection.MultiSelect = true;
                    view.CopyToClipboard();
                });
                SAR = new DXMenuItem("Select All Records", (o1, e1) =>
                {
                    view.OptionsSelection.MultiSelect = true;
                    view.SelectAll();
                });
                Expand = new DXMenuItem("Expand All", (o1, e1) =>
                {
                    MasterGridView.ExpandAllGroups();
                });
                Collapse = new DXMenuItem("Collapse All", (o1, e1) =>
                {
                    MasterGridView.CollapseAllGroups();
                });
                FixLeft = new DXMenuItem("Fix Column Left", (o1, e1) =>
                {
                    MasterGridView.OptionsView.ColumnAutoWidth = false;
                    var hitInfo = MasterGridView.CalcHitInfo(MasterGrid.PointToClient(Control.MousePosition));
                    if (hitInfo.InRowCell)
                    {
                        int rowHandle = hitInfo.RowHandle;
                        DevExpress.XtraGrid.Columns.GridColumn column = new DevExpress.XtraGrid.Columns.GridColumn();
                        column       = hitInfo.Column;
                        column.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left;
                    }
                });
                FixRight = new DXMenuItem("Fix Column Right", (o1, e1) =>
                {
                    MasterGridView.OptionsView.ColumnAutoWidth = false;
                    var hitInfo = MasterGridView.CalcHitInfo(MasterGrid.PointToClient(Control.MousePosition));
                    if (hitInfo.InRowCell)
                    {
                        int rowHandle = hitInfo.RowHandle;
                        DevExpress.XtraGrid.Columns.GridColumn column = new DevExpress.XtraGrid.Columns.GridColumn();
                        column       = hitInfo.Column;
                        column.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Right;
                    }
                });
                UnFix = new DXMenuItem("Unfix Column", (o1, e1) =>
                {
                    MasterGridView.OptionsView.ColumnAutoWidth = false;
                    var hitInfo = MasterGridView.CalcHitInfo(MasterGrid.PointToClient(Control.MousePosition));
                    if (hitInfo.InRowCell)
                    {
                        int rowHandle = hitInfo.RowHandle;
                        DevExpress.XtraGrid.Columns.GridColumn column = new DevExpress.XtraGrid.Columns.GridColumn();
                        column       = hitInfo.Column;
                        column.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.None;
                    }
                });
                e.Menu.Items.Add(Copy);
                e.Menu.Items.Add(SAR);
                e.Menu.Items.Add(Collapse);
                e.Menu.Items.Add(Expand);
                e.Menu.Items.Add(FixLeft);
                e.Menu.Items.Add(FixRight);
                e.Menu.Items.Add(UnFix);
            }

            catch (Exception ex)

            {
                ProjectFunctions.SpeakError(ex.Message);
            }
        }
Exemple #3
0
        private void PivotGridControl_PopupMenuShowing(object sender, DevExpress.XtraPivotGrid.PopupMenuShowingEventArgs e)
        {
            try
            {
                e.Menu.Items.Add(new DXMenuItem("Select Range", (o1, e1) =>
                {
                    Controls.Add(_RangeSelector);
                    _RangeSelector.BtnLoad.Click += new EventHandler(BtnLoad_Click);
                    _RangeSelector.BringToFront();
                    _RangeSelector.Location = new Point(e.Point.X + 20, e.Point.Y + 20);
                    _RangeSelector.Show();
                    _RangeSelector.DtFrom.Focus();
                }));
                e.Menu.Items.Add(new DXMenuItem("Print Report", (o1, e1) =>
                {
                    var bp = new FormReports.BasePrint()
                    {
                        ReportName = GlobalVariables.ProgDesc
                    };
                    bp.PrintPivotToReport(PivotGridControl, ProjectFunctions.GetDataSet("select ProCaption from ProgramMaster Where ProgCode='" + GlobalVariables.ProgCode + "'").Tables[0].Rows[0]["ProCaption"].ToString() + " From " + _RangeSelector.StartDate.Date.ToString("dd-MM-yyyy") + " To " + _RangeSelector.EndDate.Date.ToString("dd-MM-yyyy"));
                }));
                e.Menu.Items.Add(new DXMenuItem("Disable Merging While Printing", (o1, e1) =>
                {
                    PivotGridControl.OptionsPrint.MergeRowFieldValues    = false;
                    PivotGridControl.OptionsPrint.MergeColumnFieldValues = false;
                }));

                e.Menu.Items.Add(new DXMenuItem("Enable Merging While Printing", (o1, e1) =>
                {
                    PivotGridControl.OptionsPrint.MergeRowFieldValues    = true;
                    PivotGridControl.OptionsPrint.MergeColumnFieldValues = true;
                }));
                e.Menu.Items.Add(new DXMenuItem("Save Report Layout", (o1, e1) =>
                {
                    ProjectFunctions.ButtonVisualize(_RepLayout);
                    _RepLayout.PGC = PivotGridControl;
                    _RepLayout.BringToFront();
                    _RepLayout.Location = new Point(e.Point.X + 20, e.Point.Y + 20);
                    _RepLayout.Show();
                }));

                e.Menu.Items.Add(new DXMenuItem("Load Report Layout", (o1, e1) =>
                {
                    ProjectFunctions.ButtonVisualize(_LoadLayout);
                    _LoadLayout.BringToFront();
                    _LoadLayout.PGC      = PivotGridControl;
                    _LoadLayout.Location = new Point(e.Point.X + 20, e.Point.Y + 20);
                    _LoadLayout.Show();
                }));

                e.Menu.Items.Add(new DXMenuItem(PivotGridControl.OptionsView.ShowColumnGrandTotals ? "Hide Grand Totals" : "Show Grand Totals", (o1, e1) =>
                {
                    PivotGridControl.OptionsView.ShowColumnGrandTotals      = PivotGridControl.OptionsView.ShowColumnGrandTotals ? false : true;
                    PivotGridControl.OptionsView.ShowColumnGrandTotalHeader = PivotGridControl.OptionsView.ShowColumnGrandTotalHeader ? false : true;
                }));
                e.Menu.Items.Add(new DXMenuItem("Close", (o1, e1) =>
                {
                    Close();
                }));
            }
            catch (Exception ex)
            {
                ProjectFunctions.SpeakError(ex.Message);
            }
        }