예제 #1
0
        public ABCGridRowDetail(IABCGridControl grid)
        {
            ABCGrid = grid;
            InitializeComponent();
            Initialize();

            this.VGrid.Appearance.DisabledRow.BackColor                    = Color.FromArgb(181, 200, 223);
            this.VGrid.Appearance.DisabledRow.ForeColor                    = Color.Black;
            this.VGrid.Appearance.DisabledRow.Options.UseBackColor         = true;
            this.VGrid.Appearance.DisabledRow.Options.UseForeColor         = true;
            this.VGrid.Appearance.DisabledRecordValue.BackColor            = Color.FromArgb(181, 200, 223);
            this.VGrid.Appearance.DisabledRecordValue.ForeColor            = Color.Black;
            this.VGrid.Appearance.DisabledRecordValue.Options.UseBackColor = true;
            this.VGrid.Appearance.DisabledRecordValue.Options.UseForeColor = true;
            this.VGrid.Appearance.Empty.BackColor            = Color.FromArgb(181, 200, 223);
            this.VGrid.Appearance.Empty.Options.UseBackColor = true;

            this.Shown                        += new EventHandler(ABCGridRowDetail_Shown);
            this.FormClosing                  += new FormClosingEventHandler(ABCGridRowDetail_FormClosing);
            this.VGrid.CustomUnboundData      += new DevExpress.XtraVerticalGrid.Events.CustomDataEventHandler(VGrid_CustomUnboundData);
            this.VGrid.CustomDrawRowValueCell += new DevExpress.XtraVerticalGrid.Events.CustomDrawRowValueCellEventHandler(vGridControl1_CustomDrawRowValueCell);
            this.VGrid.MouseClick             += new MouseEventHandler(VGrid_MouseClick);
            (this.ABCGrid as Control).FindForm().LocationChanged += new EventHandler(ABCGridRowDetail_LocationChanged);
            (this.ABCGrid as Control).FindForm().FormClosing     += new FormClosingEventHandler(ParentForm_FormClosing);
        }
예제 #2
0
        public void InitActions(IABCGridControl grid)
        {
            GridControl = grid;
            if (GridControl != null)
            {
                if (this.Binding.DataManager.MainObject != null || this.Binding.Config.AutoSave)
                {
                    if (GridControl is ABCGridControl)
                    {
                        (GridControl as ABCGridControl).ShowSaveButton = false;
                    }
                    if (GridControl is ABCGridBandedControl)
                    {
                        (GridControl as ABCGridBandedControl).ShowSaveButton = false;
                    }
                }
                GridControl.BarItemClick += new ABCDefineEvents.ABCBarItemClickEventHandler(GridControl_BarItemClick);

                #region Permissions
                if (ABCScreenManager.Instance.CheckTablePermission(this.TableName, TablePermission.AllowView) == false)
                {
                    if (GridControl is ABCGridControl)
                    {
                        (GridControl as ABCGridControl).ShowSaveButton     = false;
                        (GridControl as ABCGridControl).ShowDeleteButton   = false;
                        (GridControl as ABCGridControl).NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                    }
                    if (GridControl is ABCGridBandedControl)
                    {
                        (GridControl as ABCGridBandedControl).ShowSaveButton     = false;
                        (GridControl as ABCGridBandedControl).ShowDeleteButton   = false;
                        (GridControl as ABCGridBandedControl).NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                    }
                }
                if (this.Binding.Config.DisplayOnly || ABCScreenManager.Instance.CheckTablePermission(this.TableName, TablePermission.AllowNew) == false)
                {
                    if (GridControl is ABCGridControl)
                    {
                        (GridControl as ABCGridControl).NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                    }
                    if (GridControl is ABCGridBandedControl)
                    {
                        (GridControl as ABCGridBandedControl).NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                    }
                }
                if (this.Binding.Config.DisplayOnly || ABCScreenManager.Instance.CheckTablePermission(this.TableName, TablePermission.AllowDelete) == false)
                {
                    if (GridControl is ABCGridControl)
                    {
                        (GridControl as ABCGridControl).ShowDeleteButton = false;
                    }
                    if (GridControl is ABCGridBandedControl)
                    {
                        (GridControl as ABCGridBandedControl).ShowDeleteButton = false;
                    }
                }
                if (this.Binding.Config.DisplayOnly || ABCScreenManager.Instance.CheckTablePermission(this.TableName, TablePermission.AllowEdit) == false)
                {
                    if (GridControl is ABCGridControl)
                    {
                        (GridControl as ABCGridControl).DefaultView.OptionsBehavior.Editable = false;
                        (GridControl as ABCGridControl).DefaultView.OptionsSelection.EnableAppearanceFocusedCell = false;
                        (GridControl as ABCGridControl).DefaultView.OptionsSelection.EnableAppearanceFocusedRow  = true;
                        (GridControl as ABCGridControl).DefaultView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
                    }
                    if (GridControl is ABCGridBandedControl)
                    {
                        (GridControl as ABCGridBandedControl).BandedView.OptionsBehavior.Editable = false;
                        (GridControl as ABCGridBandedControl).BandedView.OptionsSelection.EnableAppearanceFocusedCell = false;
                        (GridControl as ABCGridBandedControl).BandedView.OptionsSelection.EnableAppearanceFocusedRow  = true;
                        (GridControl as ABCGridBandedControl).BandedView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
                    }
                }

                if (this.Binding.Config.DisplayOnly)
                {
                    if (GridControl is ABCGridControl)
                    {
                        (GridControl as ABCGridControl).ShowSaveButton     = false;
                        (GridControl as ABCGridControl).ShowDeleteButton   = false;
                        (GridControl as ABCGridControl).NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                    }
                    if (GridControl is ABCGridBandedControl)
                    {
                        (GridControl as ABCGridBandedControl).ShowSaveButton     = false;
                        (GridControl as ABCGridBandedControl).ShowDeleteButton   = false;
                        (GridControl as ABCGridBandedControl).NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                    }
                }
                #endregion
            }
        }