Ejemplo n.º 1
0
        /// <summary>
        /// Reconfig properties of gridview
        /// </summary>
        /// <param name="gridView">GridView</param>
        public static void ReconfigGridView(DevExpress.XtraGrid.Views.Grid.GridView gridView)
        {
            gridView.BestFitColumns();

            if (gridView.OptionsBehavior.ReadOnly)
            {
                gridView.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False;
                gridView.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.False;
                gridView.OptionsBehavior.Editable = false;
            }

            if (gridView.OptionsBehavior.AllowAddRows == DevExpress.Utils.DefaultBoolean.False)
            {
                gridView.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
            }
            else if(gridView.OptionsBehavior.AllowAddRows == DevExpress.Utils.DefaultBoolean.True)
            {
                gridView.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;
            }

            gridView.OptionsView.ShowGroupPanel = gridView.OptionsCustomization.AllowGroup;
            gridView.OptionsView.ShowAutoFilterRow = gridView.OptionsCustomization.AllowFilter;

            //if (gridView.OptionsCustomization.AllowFilter == true)
            //    gridView.OptionsView.ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode.ShowAlways;
            //else
            gridView.OptionsView.ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode.Never;
        }
Ejemplo n.º 2
0
        public static void BestFitAllColumns(DevExpress.XtraGrid.Views.Grid.GridView gridView)
        {
            gridView.BestFitColumns();

            for (int i = 0; i < gridView.Columns.Count; i++)
            {
                gridView.Columns[i].BestFit();
            }
        }
        private void AgregarRenglonAlGrid(DevExpress.XtraGrid.GridControl Grid, DevExpress.XtraGrid.Views.Grid.GridView GV)
        {
            var lstRegistros = (List<ChequeTransferencia>)Grid.DataSource;

            if (lstRegistros.Count >= 0)
            {
                ChequeTransferencia registro = new ChequeTransferencia();
                registro.Identificador = string.Empty;
                registro.Cliente = string.Empty;
                registro.Banco = string.Empty;
                registro.Importe = 0;

                lstRegistros.Add(registro);

                Grid.DataSource = lstRegistros;
                GV.RefreshData();
                GV.BestFitColumns();
            }
        }
Ejemplo n.º 4
0
 //PHUOCNT NC Hàm này làm gì ? Còn cần nữa ko
 //TRANGDTT NC Hàm này làm gì ? Còn cần nữa ko
 public static void PLGridViewFix(DevExpress.XtraGrid.Views.Grid.GridView grdView)
 {
     grdView.OptionsSelection.EnableAppearanceFocusedCell = false;
     grdView.OptionsView.EnableAppearanceEvenRow = true;
     grdView.OptionsView.EnableAppearanceOddRow = true;
     //grdView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
     grdView.OptionsView.ShowFooter = true;
     //grdView.OptionsBehavior.Editable = false;
     grdView.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
     grdView.OptionsCustomization.AllowGroup = true;
     grdView.BestFitColumns();
     //XtraGridSupport.ShowNumOfRecord(grdView.GridControl);
     HelpGrid.ShowNumOfRecord(grdView.GridControl);
     for (int i = 0; i < grdView.Columns.Count; i++)
     {
         grdView.Columns[i].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
     }
 }