private void BindingDataGridNPI() { try { this.Cursor = Cursors.WaitCursor; grdView.DataSource = null; DataTable dt = SMT_MGL_GRID_MR_SELECT("Q3", "", ComVar.Var._strValue1, ""); if (!first) { _Helper.removeMerged(); } grdView.DataSource = dt; if (!first) { _Helper.removeMerged(); } formatgridNPI(); if (!first) { _Helper.removeMerged(); } formatgridNPI(); this.Cursor = Cursors.Default; //formatBand(); } catch (Exception ex) { } finally { this.Cursor = Cursors.Default; } }
private void BindingData(string _line_cd, string _mline_cd) { if (first) { _Helper = new MyCellMergeHelper(gridView1); first = false; } //grid.Refresh(); DataTable dtsource = null; grid.DataSource = dtsource; gridView1.Columns.Clear(); dtsource = SEL_INVENTORY_SHORTAGE(_line_cd, _mline_cd, "UPS", "O", "UP"); // formatband(); grid.DataSource = dtsource; //for (int i = 0; i < 4; i++) //{ // gridView1.Columns[i].Caption = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(gridView1.Columns[i].GetCaption().Replace("_", " ").ToLower()); // gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; // gridView1.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; //} gridView1.Columns[1].Width = 190; gridView1.Columns[2].Width = 90; gridView1.Columns[3].Width = 70; gridView1.OptionsView.AllowCellMerge = true; for (int i = 0; i < gridView1.Columns.Count; i++) { gridView1.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False; //gridView1.Columns[i].DisplayFormat.FormatString = "#,###,###"; if (i <= 3) { gridView1.Columns[i].Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; } } gridView1.OptionsView.ColumnAutoWidth = true; gridView1.BestFitColumns(); gridView1.TopRowIndex = gridView1.RowCount - 1; gridView1.Columns[0].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; gridView1.Columns[1].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; gridView1.Columns[2].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; //for (int i = 4; i < dtsource.Columns.Count; i++) //{ // gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; //} for (int i = 0; i < gridView1.Columns.Count; i++) { // gridView1.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; //if (i == 1) //{ // gridView1.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; //} if (i < 4) { gridView1.Columns[i].Caption = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(gridView1.Columns[i].GetCaption().Replace("_", " ").ToLower()); gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } else { gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; //gridView1.Columns[i].DisplayFormat.FormatType = g; // gridView1.Columns[i].Width = 60; } } _Helper.removeMerged(); if (first) { _Helper = new MyCellMergeHelper(gridView1); } _Helper.AddMergedCell(gridView1.RowCount - 1, 0, 1, ""); _Helper.AddMergedCell(gridView1.RowCount - 1, 1, 2, ""); _Helper.AddMergedCell(gridView1.RowCount - 1, 2, 3, ""); _Helper.AddMergedCell(gridView1.RowCount - 2, 0, 1, ""); _Helper.AddMergedCell(gridView1.RowCount - 2, 1, 2, ""); _Helper.AddMergedCell(gridView1.RowCount - 2, 2, 3, ""); _Helper.AddMergedCell(gridView1.RowCount - 3, 0, 1, ""); _Helper.AddMergedCell(gridView1.RowCount - 3, 1, 2, ""); _Helper.AddMergedCell(gridView1.RowCount - 3, 2, 3, ""); //if (dtsource != null && dtsource.Rows.Count > 0) //{ // for (int i = 0; i < grid.Columns.Count; i++) // { // grid.Columns[i].OptionsColumn.ReadOnly = true; // grid.Columns[i].OptionsColumn.AllowEdit = false; // grid.Columns[i].OptionsFilter.AllowFilter = false; // grid.Columns[i].OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; // grid.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; // grid.Columns[i].AppearanceCell.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center; // if (i > 0) // { // grid.Columns[i].AppearanceCell.Font = new System.Drawing.Font("Calibri", 12, FontStyle.Bold); // } // } //} }
private void BindingData(string _line_cd, string _mline_cd) { if (first) { _Helper = new MyCellMergeHelper(gridView1); first = false; } grid.Refresh(); DataTable dtsource = null; grid.DataSource = dtsource; gridView1.Columns.Clear(); dtsource = SEL_INVENTORY_SHORTAGE(_line_cd, _mline_cd, "UPS", "O", "UP"); grid.DataSource = dtsource; gridView1.Columns[0].Width = 90; gridView1.Columns[1].Width = 190; gridView1.Columns[2].Width = 93; gridView1.Columns[3].Width = 108; gridView1.OptionsView.AllowCellMerge = true; for (int i = 0; i < gridView1.Columns.Count; i++) { gridView1.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False; if (i <= 3) { gridView1.Columns[i].Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; } } gridView1.TopRowIndex = gridView1.RowCount - 1; gridView1.Columns[0].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; gridView1.Columns[1].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; gridView1.Columns[2].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; for (int i = 0; i < gridView1.Columns.Count; i++) { if (i < 4) { gridView1.Columns[i].Caption = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(gridView1.Columns[i].GetCaption().Replace("_", " ").ToLower()); gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } else { gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; } } _Helper.removeMerged(); if (first) { _Helper = new MyCellMergeHelper(gridView1); } _Helper.AddMergedCell(gridView1.RowCount - 1, 0, 1, ""); _Helper.AddMergedCell(gridView1.RowCount - 1, 1, 2, ""); _Helper.AddMergedCell(gridView1.RowCount - 1, 2, 3, ""); _Helper.AddMergedCell(gridView1.RowCount - 2, 0, 1, ""); _Helper.AddMergedCell(gridView1.RowCount - 2, 1, 2, ""); _Helper.AddMergedCell(gridView1.RowCount - 2, 2, 3, ""); _Helper.AddMergedCell(gridView1.RowCount - 3, 0, 1, ""); _Helper.AddMergedCell(gridView1.RowCount - 3, 1, 2, ""); _Helper.AddMergedCell(gridView1.RowCount - 3, 2, 3, ""); }