private void CreateColumns(DevExpress.XtraGrid.Views.BandedGrid.GridBand gridBand1, DevExpress.XtraGrid.Views.BandedGrid.GridBand gridBand2) { //***** 1 ********** //DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn1 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn2 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn3 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn4 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn5 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn6 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn7 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn8 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn9 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn10 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn11 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn12 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn13 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bandedGridColumn14 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); //bandedGridColumn1.Caption = "Type"; //bandedGridColumn1.FieldName = "bcType"; //bandedGridColumn1.Visible = true; //bandedGridColumn1.RowCount = 2; bandedGridColumn2.Caption = "Size"; bandedGridColumn2.FieldName = "bcSize"; bandedGridColumn2.Visible = true; bandedGridColumn3.Caption = "Fabric No."; bandedGridColumn3.FieldName = "bcFabric"; bandedGridColumn3.Visible = true; bandedGridColumn4.Caption = "Vendor"; bandedGridColumn4.FieldName = "bcVendor"; bandedGridColumn4.Visible = true; bandedGridColumn5.Caption = "Garment" + Environment.NewLine + "Part"; bandedGridColumn5.FieldName = "bcGarmentPart"; bandedGridColumn5.Visible = true; bandedGridColumn6.Caption = "Color No."; bandedGridColumn6.FieldName = "bcColorNo"; bandedGridColumn6.Visible = true; bandedGridColumn7.Caption = "Color Name"; bandedGridColumn7.FieldName = "bcColorName"; bandedGridColumn7.Visible = true; bandedGridColumn8.Caption = "Width" + Environment.NewLine + "(All)"; bandedGridColumn8.FieldName = "bcWidthAll"; bandedGridColumn8.Visible = true; bandedGridColumn9.Caption = "Width" + Environment.NewLine + "(Use)"; bandedGridColumn9.FieldName = "bcWidthUse"; bandedGridColumn9.Visible = true; bandedGridColumn10.Caption = "g/m"; bandedGridColumn10.FieldName = "bcGM"; bandedGridColumn10.Visible = true; bandedGridColumn11.Caption = "m/1P"; bandedGridColumn11.FieldName = "bcM1P"; bandedGridColumn11.Visible = true; bandedGridColumn12.Caption = "kg/1P"; bandedGridColumn12.FieldName = "bcKg1P"; bandedGridColumn12.Visible = true; bandedGridColumn13.Caption = "Price" + Environment.NewLine + "(Baht)"; bandedGridColumn13.FieldName = "bcPrice"; bandedGridColumn13.Visible = true; bandedGridColumn14.Caption = "%Loss"; bandedGridColumn14.FieldName = "bcLoss"; bandedGridColumn14.Visible = true; //gridBand1.Columns.Add(bandedGridColumn1); gridBand1.Columns.Add(bandedGridColumn2); gridBand1.Columns.Add(bandedGridColumn3); gridBand1.Columns.Add(bandedGridColumn4); gridBand1.Columns.Add(bandedGridColumn5); gridBand1.Columns.Add(bandedGridColumn6); gridBand1.Columns.Add(bandedGridColumn7); gridBand1.Columns.Add(bandedGridColumn8); gridBand1.Columns.Add(bandedGridColumn9); gridBand1.Columns.Add(bandedGridColumn10); gridBand1.Columns.Add(bandedGridColumn11); gridBand1.Columns.Add(bandedGridColumn12); gridBand1.Columns.Add(bandedGridColumn13); gridBand1.Columns.Add(bandedGridColumn14); //***** 2 ********** List <string> listSize = new List <string>(); listSize.Add("S"); listSize.Add("M"); listSize.Add("S"); listSize.Add("M"); List <string> listColor = new List <string>(); listColor.Add("03 Gray"); listColor.Add("03 Gray"); listColor.Add("16 Red"); listColor.Add("16 Red"); int x = 0; foreach (string items in listColor) { DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn bGridCol = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); bGridCol.Caption = listSize[x] + Environment.NewLine + items; bGridCol.FieldName = "BCS" + (x + 1).ToString(); bGridCol.Visible = true; gridBand2.Columns.Add(bGridCol); x++; } bgvFabric.ColumnPanelRowHeight = 38; bgvFabric.Appearance.HeaderPanel.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; bgvFabric.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; bgvFabric.Appearance.BandPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; bgvFabric.Appearance.FooterPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; for (int ii = 0; ii < bgvFabric.Columns.Count; ii++) { bgvFabric.Columns[ii].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } if (bgvFabric.Columns.Count > 13) { for (int ii = 13; ii < bgvFabric.Columns.Count; ii++) { bgvFabric.Columns[ii].AppearanceHeader.BackColor = Color.FromArgb(255, 222, 222); } } bgvFabric.OptionsView.ColumnAutoWidth = false; bgvFabric.BestFitColumns(); //gridBand2.Columns.Add(listColumnColor); }
private void Form1Print_Load(object sender, EventArgs e) { if (!isselect) { barButtonItem4.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; } gridBand2.Visible = false; gridControl1.DataSource = GridDataTable; this.bandedGridView1.GroupPanelText = this.Text; //int numi = 0; //DevExpress.XtraGrid.Views.BandedGrid.GridBand[] gridBandDate = new DevExpress.XtraGrid.Views.BandedGrid.GridBand[listCount * 2]; //DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[] gridColumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[listCount * 2]; foreach (DataColumn dc in GridDataTable.Columns) { if (dc.ColumnName.IndexOf("Äê") > 0) { gridBand2.Visible = true; DevExpress.XtraGrid.Views.BandedGrid.GridBand gbi = new DevExpress.XtraGrid.Views.BandedGrid.GridBand(); gbi.Caption = dc.ColumnName; gbi.Name = dc.ColumnName; gbi.AppearanceHeader.Options.UseTextOptions = true; gbi.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gridBand2.Children.Add(gbi); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn gridColumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); gridColumn.Caption = dc.ColumnName; gridColumn.FieldName = dc.ColumnName; gridColumn.Name = "Column" + dc.ColumnName; gridColumn.Visible = true; gridColumn.DisplayFormat.FormatString = "n2"; gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; bandedGridView1.Columns.Add(gridColumn); gbi.Columns.Add(gridColumn); } if (dc.ColumnName.Substring(0, 1) == "S") { foreach (GridBand gc in bandedGridView1.Bands) { try { if (gc.Columns[0].FieldName == dc.ColumnName) { gc.Visible = true; // int i=dc.Caption.ToString().IndexOf("@"); gc.Caption = dc.Caption; // gc.VisibleIndex =int.Parse(dc.Caption.ToString().Substring(i-1,dc.Caption.Length- i)); gc.AppearanceHeader.Options.UseTextOptions = true; gc.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } } catch { } } //gbi =bandedGridView1.Bands; //gbi.Caption = dc.ColumnName; //gbi.Name = dc.ColumnName; //gbi.AppearanceHeader.Options.UseTextOptions = true; //gbi.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; //gridBand2.Children.Add(gbi); //DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn gridColumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); //gridColumn.Caption = dc.ColumnName; //gridColumn.FieldName = dc.ColumnName; //gridColumn.Name = "Column" + dc.ColumnName; //gridColumn.Visible = true; //gridColumn.DisplayFormat.FormatString = "n2"; //gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; //bandedGridView1.Columns.Add(gridColumn); //gbi.Columns.Add(gridColumn); } } //if (!isselect) //{ // //barButtonItem4.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; // this.Hide(); // ComponentPrint.ShowPreview(this.gridControl1, this.bandedGridView1.GroupPanelText); // this.Close(); //} //else //{ // title = this.bandedGridView1.GroupPanelText; // this.DialogResult = DialogResult.OK; //} }
private void PopulateColumn() { dtBandCol = new DataTable(); dtBandCol.Columns.Add("General"); DataTable dtVname = new DataTable(); DataRow dr; DataTable dtVCBind = new DataTable(); dtVCBind = oVCompBL.getQuotationResorce(1); dtVname = oVCompBL.getQSubDetails(1); dtGrid = new DataTable(); dtGrid.Columns.Add("ID"); dtGrid.Columns.Add("Code"); dtGrid.Columns.Add("Description"); dtGrid.Columns.Add("Unit"); dtGrid.Columns.Add("Quantity"); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn Bcolumn;// = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.GridBand gridBand; if (dtVname.Rows.Count <= 0) { return; } else { for (int b = 0; b < dtVname.Rows.Count; b++) { dtBandCol.Columns.Add(dtVname.Rows[b]["VendorName"].ToString()); for (int t = 0; t < 4; t++) { if (t == 0) { dtGrid.Columns.Add(dtVname.Rows[b]["VendorName"].ToString() + "VendorId", typeof(int)).DefaultValue = dtVname.Rows[b]["VendorId"].ToString(); } if (t == 1) { dtGrid.Columns.Add(dtVname.Rows[b]["VendorName"].ToString() + "Rate", typeof(decimal)).DefaultValue = 0; } if (t == 2) { dtGrid.Columns.Add(dtVname.Rows[b]["VendorName"].ToString() + "QRate", typeof(decimal)).DefaultValue = 0; } if (t == 3) { dtGrid.Columns.Add(dtVname.Rows[b]["VendorName"].ToString() + "Amount", typeof(decimal)).DefaultValue = 0; } } } } if (dtVCBind.Rows.Count > 0) { for (int u = 0; u < dtVCBind.Rows.Count; u++) { dr = dtGrid.NewRow(); dr["ID"] = dtVCBind.Rows[u]["ID"].ToString(); dr["Code"] = dtVCBind.Rows[u]["Code"].ToString(); dr["Description"] = dtVCBind.Rows[u]["Description"].ToString(); dr["Unit"] = dtVCBind.Rows[u]["Unit"].ToString(); dr["Quantity"] = dtVCBind.Rows[u]["Quantity"].ToString(); dtGrid.Rows.Add(dr); } } gridView1.Bands.Clear(); gridView1.Columns.Clear(); gridView1.OptionsView.ColumnAutoWidth = false; gridView1.OptionsView.ShowGroupPanel = false; gridControl1.DataSource = dtGrid; //For Column Design if (dtBandCol.Columns.Count <= 0) { return; } else { for (int i = 0; i < dtBandCol.Columns.Count; i++) { if (i == 0) { gridBand = new GridBand(); gridBand.Name = ""; gridBand.Caption = ""; gridBand.OptionsBand.AllowMove = false; gridBand.OptionsBand.AllowPress = false; gridView1.Bands.Add(gridBand); } else { gridBand = new GridBand(); gridBand.Name = dtBandCol.Columns[i].ToString(); gridBand.Caption = dtBandCol.Columns[i].ToString(); gridBand.OptionsBand.AllowMove = false; gridBand.OptionsBand.AllowPress = false; gridView1.Bands.Add(gridBand); } } DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit qualiButEdit = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); qualiButEdit.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; //qualiButEdit.Click += new EventHandler(qualiButEdit_Click); DevExpress.XtraEditors.Repository.RepositoryItemTextEdit RatetxtEdit = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit(); RatetxtEdit.Validating += new CancelEventHandler(RatetxtEdit_Validating); DevExpress.XtraEditors.Repository.RepositoryItemTextEdit amttxtEdit = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit(); //amttxtEdit.Validating += new CancelEventHandler(amttxtEdit_Validating); int colCount = (gridView1.Bands.Count - 1) * 4; int balColCount = dtGrid.Columns.Count - colCount; int finColCunt = (dtGrid.Columns.Count - balColCount) / (gridView1.Bands.Count - 1); int m; for (int j = 0; j < gridView1.Bands.Count; j++) { gridView1.Bands[j].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; if (j == 0) { for (int k = 0; k < dtGrid.Columns.Count - colCount; k++) { if (dtGrid.Columns[k].ToString() == "ID") { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = dtGrid.Columns[k].ToString(); Bcolumn.Name = dtGrid.Columns[k].ToString(); Bcolumn.FieldName = dtGrid.Columns[k].ToString(); Bcolumn.Visible = false; gridView1.Bands[j].Columns.Add(Bcolumn); } else { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = dtGrid.Columns[k].ToString(); Bcolumn.Name = dtGrid.Columns[k].ToString(); Bcolumn.FieldName = dtGrid.Columns[k].ToString(); Bcolumn.Visible = true; if (dtGrid.Columns[k].ToString() == "Code" || dtGrid.Columns[k].ToString() == "Unit") { Bcolumn.Width = 50; } if (dtGrid.Columns[k].ToString() == "Quantity") { Bcolumn.Width = 50; } if (dtGrid.Columns[k].ToString() == "Description") { Bcolumn.Width = 150; } Bcolumn.OptionsColumn.AllowEdit = false; gridView1.Bands[j].Columns.Add(Bcolumn); } } } else { for (m = 5; m < dtGrid.Columns.Count; m++) { if (dtGrid.Columns[m].ToString().Contains(gridView1.Bands[j] + "QRate")) { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = "QRate"; Bcolumn.Name = dtGrid.Columns[m].ToString(); Bcolumn.FieldName = dtGrid.Columns[m].ToString(); Bcolumn.Visible = true; Bcolumn.OptionsColumn.AllowEdit = true; Bcolumn.ColumnEdit = qualiButEdit; Bcolumn.Width = 90; gridView1.Bands[j].Columns.Add(Bcolumn); } if (dtGrid.Columns[m].ToString().Contains(gridView1.Bands[j] + "VendorId")) { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = "VendorId"; Bcolumn.Name = dtGrid.Columns[m].ToString(); Bcolumn.FieldName = dtGrid.Columns[m].ToString(); Bcolumn.Visible = false; Bcolumn.OptionsColumn.AllowEdit = false; gridView1.Bands[j].Columns.Add(Bcolumn); } if (dtGrid.Columns[m].ToString().Contains(gridView1.Bands[j] + "Rate") || dtGrid.Columns[m].ToString().Contains(gridView1.Bands[j] + "Amount")) { if (dtGrid.Columns[m].ToString().Contains(gridView1.Bands[j] + "Rate")) { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = "Rate"; Bcolumn.Name = dtGrid.Columns[m].ToString(); Bcolumn.FieldName = dtGrid.Columns[m].ToString(); Bcolumn.Visible = true; Bcolumn.OptionsColumn.AllowEdit = true; Bcolumn.ColumnEdit = RatetxtEdit; Bcolumn.Width = 40; gridView1.Bands[j].Columns.Add(Bcolumn); } else { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = "Amount"; Bcolumn.Name = dtGrid.Columns[m].ToString(); Bcolumn.FieldName = dtGrid.Columns[m].ToString(); Bcolumn.Visible = true; Bcolumn.OptionsColumn.AllowEdit = true; Bcolumn.ColumnEdit = RatetxtEdit; Bcolumn.Width = 90; gridView1.Bands[j].Columns.Add(Bcolumn); } } } m += 1; } } } }
//private void Populate() //{ // // creating new bands // DevExpress.XtraGrid.Views.BandedGrid.GridBand gridBand = new DevExpress.XtraGrid.Views.BandedGrid.GridBand(); // DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); // //Dispose of the old view // gridControl2.MainView.Dispose(); // //Create a Banded Grid View // BandedGridView bandedView = new BandedGridView(gridControl2); // gridControl2.MainView = bandedView; // //bandedGridView1.Columns.Clear(); // //bandedGridView1.Bands.Clear(); // for (int i = 1; i <=2; i++) // { // //gridBand = new DevExpress.XtraGrid.Views.BandedGrid.GridBand(); // //gridBand.Name = "Vendor" + i; // //gridBand.Caption = "Vendor" + i; // //gridBand.OptionsBand.AllowMove = false; // //gridBand.OptionsBand.AllowPress = false; // //bandedGridView1.Bands.Add(gridBand); // gridBand = bandedView.Bands.AddBand("Vendor" + i); // } // for (int j = 1; j <= 2;j++) // { // Bcolumn = (BandedGridColumn)bandedView.Columns.AddField("Column" + j); // Bcolumn.OwnerBand = gridBand; // Bcolumn.Visible = true; // //Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); // //Bcolumn.OptionsColumn.AllowMove = false; // //Bcolumn.Caption = "column" + j; // //Bcolumn.Name = "Column"; // //Bcolumn.FieldName = "Column" + j; // //Bcolumn.Visible = true; // //gridBand.Columns.Add(Bcolumn); // //bandedGridView1.Bands[j].Columns.Add(Bcolumn); // //if (bandedGridView1.Bands.Count > 0) // //{ // // for (int k = j; k <=bandedGridView1.Bands.Count; k++) // // { // // bandedGridView1.Bands[k].Columns.Add(Bcolumn); // // } // //} // //gridBand.Columns.Add(Bcolumn); // } // //bandedGridView1.Bands.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.GridBand[]{gridBand}); // bandedGridView1.GridControl = gridControl2; // bandedGridView1.EndInit(); // //// creating first column // //DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn column1 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); // //column1.OptionsColumn.AllowMove = false; // //column1.Caption = "column1"; // //column1.Name = "Column1"; // //column1.FieldName = "Column1"; // //column1.Visible = true; // //// creating second column // //DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn column2 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); // //column2.OptionsColumn.AllowMove = false; // //column2.Caption = "column2"; // //column2.Name = "Column2"; // //column2.FieldName = "Column2"; // //column2.Visible = true; // // adding bands and columns // //bandedGridView1.Columns.Clear(); // //bandedGridView1.Bands.Clear(); // //bandedGridView1.Bands.Add(gridBand); // ////bandedGridView1.Bands.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.GridBand[]{gridBand}); // //gridBand.Columns.Add( column1 ); // //gridBand.Columns.Add( column2 ); // //bandedGridView1.GridControl = gridControl2; // //bandedGridView1.EndInit(); // } //private void NewFunction() //{ // //Dispose of the old view // gridControl2.MainView.Dispose(); // //Create a Banded Grid View // BandedGridView bandedView = new BandedGridView(gridControl2); // gridControl2.MainView = bandedView; // //Add one band and one column to the view // GridBand band = bandedView.Bands.AddBand("General"); // BandedGridColumn column = (BandedGridColumn)bandedView.Columns.AddField("CustomerID"); // column.OwnerBand = band; // column.Visible = true; //} //private void PopulateGrid() //{ // gridControl2.MainView.Dispose(); // BandedGridView bandedView = new BandedGridView(gridControl2); // gridControl2.MainView = bandedView; // List<BandedGridColumn> Bcolumn2=new List<BandedGridColumn>(); // DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn Bcolumn;// = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); // //GridBand gridBand; // for (int i = 0; i <2; i++) // { // //bandedView.Bands.Add(new GridBand() { Caption = "Band"+i }); // GridBand gridBand = bandedView.Bands.AddBand("Band" + i); // } // for (int j = 0; j <bandedView.Bands.Count; j++) // { // //Bcolumn2.Add(new BandedGridColumn() // //{ // // Caption = "Column" + j, // // FieldName = "Field" + j, // // VisibleIndex = 0 // //}); // //Bcolumn = (BandedGridColumn)bandedView.Columns.AddField("Column" + j); // //Bcolumn.OwnerBand = gridBand; // //Bcolumn.Visible = true; // for (int k = 0; k < 3; k++) // { // Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); // Bcolumn.OptionsColumn.AllowMove = false; // Bcolumn.Caption = "column" + k; // Bcolumn.Name = "Column"; // Bcolumn.FieldName = "Column" + k; // Bcolumn.Visible = true; // bandedView.Bands[j].Columns.Add(Bcolumn); // } // //bandedView.Bands[].Columns.Add(new BandedGridColumn() { Caption = "Column" + j, FieldName = "Field" + j, VisibleIndex = 0 }); // } // //for (int k = 0; k < bandedView.Bands.Count; k++) // //{ // // //bandedView.Bands[].Columns.Add(new BandedGridColumn() { Caption = "Column" + j, FieldName = "Field" + j, VisibleIndex = 0 }); // // Bcolumn = (BandedGridColumn)bandedView.Columns.AddField("Column" + k); // // Bcolumn.OwnerBand = bandedView.Bands[k]; // // Bcolumn.Visible = true; // // bandedView.Bands[k].Columns.Add(Bcolumn); // //} // // DataTable table = new DataTable(); // // table.Columns.Add(new DataColumn("Field", typeof(string))); // // DataRow row = table.NewRow(); // // row["Field"] = "Apples"; // // table.Rows.Add(row); // // row = table.NewRow(); // // row["Field"] = "Bananas"; // // table.Rows.Add(row); // // row = table.NewRow(); // // row["Field"] = "Pears"; // // table.Rows.Add(row); // //gridControl2.DataSource = table; //} private void PopulateGrid2() { DataTable dtCol = new DataTable(); dtCol.Columns.Add("ID"); dtCol.Columns.Add("Code"); dtCol.Columns.Add("Description"); dtCol.Columns.Add("Unit"); dtCol.Columns.Add("Quantity"); //dtCol.Columns.Add("VendorId"); dtCol.Columns.Add("Rate", typeof(decimal)); dtCol.Columns.Add("QRate", typeof(decimal)); dtCol.Columns.Add("Amount", typeof(decimal)); dtBandCol = new DataTable(); dtBandCol.Columns.Add("General"); DataTable dtVname = new DataTable(); dtVname = oVCompBL.getQSubDetails(1); if (dtVname.Rows.Count <= 0) { return; } else { for (int b = 0; b < dtVname.Rows.Count; b++) { dtBandCol.Columns.Add(dtVname.Rows[b]["VendorName"].ToString()); } } DataTable dtVCBind = new DataTable(); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn Bcolumn;// = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); DevExpress.XtraGrid.Views.BandedGrid.GridBand gridBand; dtVCBind = oVCompBL.getQuotationResorce(1); gridView1.Bands.Clear(); gridView1.Columns.Clear(); gridView1.OptionsView.ColumnAutoWidth = false; gridView1.OptionsView.ShowGroupPanel = false; gridControl1.DataSource = dtVCBind; gridView1.Columns["ID"].Visible = false; //For Column Design if (dtBandCol.Columns.Count <= 0) { return; } else { for (int i = 0; i < dtBandCol.Columns.Count; i++) { gridBand = new GridBand(); gridBand.Name = dtBandCol.Columns[i].ToString(); gridBand.Caption = dtBandCol.Columns[i].ToString(); gridBand.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gridBand.OptionsBand.AllowMove = false; gridBand.OptionsBand.AllowPress = false; gridView1.Bands.Add(gridBand); } DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit qualiButEdit = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); qualiButEdit.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; //qualiButEdit.Click += new EventHandler(qualiButEdit_Click); DevExpress.XtraEditors.Repository.RepositoryItemTextEdit RatetxtEdit = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit(); RatetxtEdit.Validating += new CancelEventHandler(RatetxtEdit_Validating); DevExpress.XtraEditors.Repository.RepositoryItemTextEdit amttxtEdit = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit(); //amttxtEdit.Validating += new CancelEventHandler(amttxtEdit_Validating); for (int j = 0; j < gridView1.Bands.Count; j++) { if (j == 0) { for (int k = 0; k < dtCol.Columns.Count - 3; k++) { if (dtCol.Columns[k].ToString() == "ID") { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = dtCol.Columns[k].ToString(); Bcolumn.Name = dtCol.Columns[k].ToString(); Bcolumn.FieldName = dtCol.Columns[k].ToString(); Bcolumn.Visible = false; gridView1.Bands[j].Columns.Add(Bcolumn); } else { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = dtCol.Columns[k].ToString(); Bcolumn.Name = dtCol.Columns[k].ToString(); Bcolumn.FieldName = dtCol.Columns[k].ToString(); Bcolumn.Visible = true; gridView1.Bands[j].Columns.Add(Bcolumn); } } } else { for (int k = 5; k < dtCol.Columns.Count; k++) { if (dtCol.Columns[k].ToString() == "Rate" || dtCol.Columns[k].ToString() == "QRate" || dtCol.Columns[k].ToString() == "Amount") { if (dtCol.Columns[k].ToString() == "QRate") { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = dtCol.Columns[k].ToString(); Bcolumn.Name = dtCol.Columns[k].ToString(); Bcolumn.FieldName = gridView1.Bands[j].Name + dtCol.Columns[k].ToString(); Bcolumn.Visible = true; Bcolumn.OptionsColumn.AllowEdit = true; Bcolumn.ColumnEdit = qualiButEdit; gridView1.Bands[j].Columns.Add(Bcolumn); } else { Bcolumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Bcolumn.OptionsColumn.AllowMove = false; Bcolumn.Caption = dtCol.Columns[k].ToString(); Bcolumn.Name = dtCol.Columns[k].ToString(); Bcolumn.FieldName = gridView1.Bands[j].Name + dtCol.Columns[k].ToString(); Bcolumn.Visible = true; Bcolumn.OptionsColumn.AllowEdit = true; Bcolumn.ColumnEdit = RatetxtEdit; gridView1.Bands[j].Columns.Add(Bcolumn); } } } } } } }
protected override void CreateGridColumns() { this.colRowID = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colShelfNo = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colStyleNo = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colLotNo = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colColor = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR36 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR38 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR40 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR42 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR44 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR46 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR48 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR50 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR52 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR54 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR56 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR58 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR60 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colR62 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL38 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL40 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL42 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL44 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL46 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL48 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL50 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL52 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL54 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL56 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL58 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL60 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colL62 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colS34 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colS36 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colS38 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colS40 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colS42 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colS44 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colS46 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); this.colSubTotal = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); Columns = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[] { this.colRowID, this.colShelfNo, this.colLotNo, this.colStyleNo, this.colColor, this.colR36, this.colR38, this.colR40, this.colR42, this.colR44, this.colR46, this.colR48, this.colR50, this.colR52, this.colR54, this.colR56, this.colR58, this.colR60, this.colR62, this.colL38, this.colL40, this.colL42, this.colL44, this.colL46, this.colL48, this.colL50, this.colL52, this.colL54, this.colL56, this.colL58, this.colL60, this.colL62, this.colS34, this.colS36, this.colS38, this.colS40, this.colS42, this.colS44, this.colS46, this.colSubTotal }; // // colRowID // this.colRowID.Caption = "RowID"; this.colRowID.FieldName = "RowID"; this.colRowID.Name = "colRowID"; this.colRowID.Visible = false; this.colRowID.Width = 50; this.colRowID.UnboundType = DevExpress.Data.UnboundColumnType.String; // // colShelfNo // this.colShelfNo.Caption = "货架号"; this.colShelfNo.FieldName = "ShelfNo"; this.colShelfNo.Name = "colShelfNo"; this.colShelfNo.Visible = true; this.colShelfNo.Width = 70; this.colShelfNo.UnboundType = DevExpress.Data.UnboundColumnType.String; // // colStyleNo // this.colStyleNo.Caption = "Style#"; this.colStyleNo.FieldName = "StyleNo"; this.colStyleNo.Name = "colStyleNo"; this.colStyleNo.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colStyleNo.Visible = true; this.colStyleNo.Width = 65; // // colLotNo // this.colLotNo.Caption = "Art#"; this.colLotNo.FieldName = "LotNo"; this.colLotNo.Name = "colLotNo"; this.colLotNo.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colLotNo.Visible = true; this.colLotNo.Width = 70; // // colColor // this.colColor.Caption = "颜色"; this.colColor.FieldName = "Color"; this.colColor.Name = "colColor"; this.colColor.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colColor.Visible = true; this.colColor.Width = 60; // // colR36 // this.colR36.Caption = "36"; this.colR36.FieldName = "R36"; this.colR36.MinWidth = 15; this.colR36.Name = "colR36"; this.colR36.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR36.Visible = true; this.colR36.Width = 20; // // colR38 // this.colR38.Caption = "38"; this.colR38.FieldName = "R38"; this.colR38.MinWidth = 15; this.colR38.Name = "colR38"; this.colR38.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR38.Visible = true; this.colR38.Width = 20; // // colR40 // this.colR40.Caption = "40"; this.colR40.FieldName = "R40"; this.colR40.MinWidth = 15; this.colR40.Name = "colR40"; this.colR40.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR40.Visible = true; this.colR40.Width = 15; // // colR42 // this.colR42.Caption = "42"; this.colR42.FieldName = "R42"; this.colR42.MinWidth = 15; this.colR42.Name = "colR42"; this.colR42.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR42.Visible = true; this.colR42.Width = 15; // // colR44 // this.colR44.Caption = "44"; this.colR44.FieldName = "R44"; this.colR44.MinWidth = 15; this.colR44.Name = "colR44"; this.colR44.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR44.Visible = true; this.colR44.Width = 15; // // colR46 // this.colR46.Caption = "46"; this.colR46.FieldName = "R46"; this.colR46.MinWidth = 15; this.colR46.Name = "colR46"; this.colR46.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR46.Visible = true; this.colR46.Width = 15; // // colR48 // this.colR48.Caption = "48"; this.colR48.FieldName = "R48"; this.colR48.MinWidth = 15; this.colR48.Name = "colR48"; this.colR48.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR48.Visible = true; this.colR48.Width = 15; // // colR50 // this.colR50.Caption = "50"; this.colR50.FieldName = "R50"; this.colR50.MinWidth = 15; this.colR50.Name = "colR50"; this.colR50.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR50.Visible = true; this.colR50.Width = 15; // // colR52 // this.colR52.Caption = "52"; this.colR52.FieldName = "R52"; this.colR52.MinWidth = 15; this.colR52.Name = "colR52"; this.colR52.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR52.Visible = true; this.colR52.Width = 15; // // colR54 // this.colR54.Caption = "54"; this.colR54.FieldName = "R54"; this.colR54.MinWidth = 15; this.colR54.Name = "colR54"; this.colR54.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR54.Visible = true; this.colR54.Width = 15; // // colR56 // this.colR56.Caption = "56"; this.colR56.FieldName = "R56"; this.colR56.MinWidth = 15; this.colR56.Name = "colR56"; this.colR56.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR56.Visible = true; this.colR56.Width = 15; // // colR58 // this.colR58.Caption = "58"; this.colR58.FieldName = "R58"; this.colR58.MinWidth = 15; this.colR58.Name = "colR58"; this.colR58.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR58.Visible = true; this.colR58.Width = 15; // // colR60 // this.colR60.Caption = "60"; this.colR60.FieldName = "R60"; this.colR60.MinWidth = 15; this.colR60.Name = "colR60"; this.colR60.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR60.Visible = true; this.colR60.Width = 15; // // colR62 // this.colR62.Caption = "62"; this.colR62.FieldName = "R62"; this.colR62.MinWidth = 15; this.colR62.Name = "colR62"; this.colR62.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colR62.Visible = true; this.colR62.Width = 68; // // colL38 // this.colL38.Caption = "38"; this.colL38.FieldName = "L38"; this.colL38.MinWidth = 15; this.colL38.Name = "colL38"; this.colL38.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL38.Visible = true; this.colL38.Width = 20; // // colL40 // this.colL40.Caption = "40"; this.colL40.FieldName = "L40"; this.colL40.MinWidth = 15; this.colL40.Name = "colL40"; this.colL40.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL40.Visible = true; // // colL42 // this.colL42.Caption = "42"; this.colL42.FieldName = "L42"; this.colL42.MinWidth = 15; this.colL42.Name = "colL42"; this.colL42.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL42.Visible = true; // // colL44 // this.colL44.Caption = "44"; this.colL44.FieldName = "L44"; this.colL44.MinWidth = 15; this.colL44.Name = "colL44"; this.colL44.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL44.Visible = true; // // colL46 // this.colL46.Caption = "46"; this.colL46.FieldName = "L46"; this.colL46.MinWidth = 15; this.colL46.Name = "colL46"; this.colL46.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL46.Visible = true; this.colL46.Width = 20; // // colL48 // this.colL48.Caption = "48"; this.colL48.FieldName = "L48"; this.colL48.MinWidth = 15; this.colL48.Name = "colL48"; this.colL48.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL48.Visible = true; this.colL48.Width = 20; // // colL50 // this.colL50.Caption = "50"; this.colL50.FieldName = "L50"; this.colL50.MinWidth = 15; this.colL50.Name = "colL50"; this.colL50.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL50.Visible = true; this.colL50.Width = 20; // // colL52 // this.colL52.Caption = "52"; this.colL52.FieldName = "L52"; this.colL52.MinWidth = 15; this.colL52.Name = "colL52"; this.colL52.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL52.Visible = true; this.colL52.Width = 20; // // colL54 // this.colL54.Caption = "54"; this.colL54.FieldName = "L54"; this.colL54.MinWidth = 15; this.colL54.Name = "colL54"; this.colL54.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL54.Visible = true; this.colL54.Width = 20; // // colL56 // this.colL56.Caption = "56"; this.colL56.FieldName = "L56"; this.colL56.MinWidth = 15; this.colL56.Name = "colL56"; this.colL56.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL56.Visible = true; this.colL56.Width = 20; // // colL58 // this.colL58.Caption = "58"; this.colL58.FieldName = "L58"; this.colL58.MinWidth = 15; this.colL58.Name = "colL58"; this.colL58.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL58.Visible = true; this.colL58.Width = 20; // // colL60 // this.colL60.Caption = "60"; this.colL60.FieldName = "L60"; this.colL60.MinWidth = 15; this.colL60.Name = "colL60"; this.colL60.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL60.Visible = true; this.colL60.Width = 20; // // colL62 // this.colL62.Caption = "62"; this.colL62.FieldName = "L62"; this.colL62.MinWidth = 15; this.colL62.Name = "colL62"; this.colL62.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colL62.Visible = true; this.colL62.Width = 20; // // colS34 // this.colS34.Caption = "34"; this.colS34.FieldName = "S34"; this.colS34.MinWidth = 15; this.colS34.Name = "colS34"; this.colS34.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colS34.Visible = true; this.colS34.Width = 20; // // colS36 // this.colS36.Caption = "36"; this.colS36.FieldName = "S36"; this.colS36.MinWidth = 15; this.colS36.Name = "colS36"; this.colS36.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colS36.Visible = true; this.colS36.Width = 20; // // colS38 // this.colS38.Caption = "38"; this.colS38.FieldName = "S38"; this.colS38.MinWidth = 15; this.colS38.Name = "colS38"; this.colS38.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colS38.Visible = true; this.colS38.Width = 20; // // colS40 // this.colS40.Caption = "40"; this.colS40.FieldName = "S40"; this.colS40.MinWidth = 15; this.colS40.Name = "colS40"; this.colS40.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colS40.Visible = true; this.colS40.Width = 20; // // colS42 // this.colS42.Caption = "42"; this.colS42.FieldName = "S42"; this.colS42.MinWidth = 15; this.colS42.Name = "colS42"; this.colS42.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colS42.Visible = true; this.colS42.Width = 20; // // colS44 // this.colS44.Caption = "44"; this.colS44.FieldName = "S44"; this.colS44.MinWidth = 15; this.colS44.Name = "colS44"; this.colS44.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colS44.Visible = true; this.colS44.Width = 20; // // colS46 // this.colS46.Caption = "46"; this.colS46.FieldName = "S46"; this.colS46.MinWidth = 15; this.colS46.Name = "colS46"; this.colS46.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colS46.Visible = true; this.colS46.Width = 20; // // colSubTotal // this.colSubTotal.Caption = "合计"; this.colSubTotal.FieldName = "SubTotal"; this.colSubTotal.MinWidth = 30; this.colSubTotal.Name = "colSubTotal"; this.colSubTotal.UnboundType = DevExpress.Data.UnboundColumnType.String; this.colSubTotal.Visible = true; this.colSubTotal.Width = 60; this.colSubTotal.OptionsColumn.AllowEdit = false; }
private void Form1Print_Load(object sender, EventArgs e) { if (!isselect) { barButtonItem4.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; } gridBand2.Visible = false; gridControl1.DataSource = GridDataTable; this.bandedGridView1.GroupPanelText = this.Text; //int numi = 0; //DevExpress.XtraGrid.Views.BandedGrid.GridBand[] gridBandDate = new DevExpress.XtraGrid.Views.BandedGrid.GridBand[listCount * 2]; //DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[] gridColumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[listCount * 2]; foreach (DataColumn dc in GridDataTable.Columns) { if (dc.ColumnName.IndexOf("Äê") > 0) { gridBand2.Visible = true; DevExpress.XtraGrid.Views.BandedGrid.GridBand gbi = new DevExpress.XtraGrid.Views.BandedGrid.GridBand(); gbi.Caption = dc.ColumnName; gbi.Name = dc.ColumnName; gbi.AppearanceHeader.Options.UseTextOptions = true; gbi.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gridBand2.Children.Add(gbi); DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn gridColumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); gridColumn.Caption = dc.ColumnName; gridColumn.FieldName = dc.ColumnName; gridColumn.Name = "Column"+dc.ColumnName; gridColumn.Visible = true; gridColumn.DisplayFormat.FormatString = "n2"; gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; bandedGridView1.Columns.Add(gridColumn); gbi.Columns.Add(gridColumn); } if (dc.ColumnName.Substring(0,1)=="S") { foreach (GridBand gc in bandedGridView1.Bands) { try { if (gc.Columns[0].FieldName == dc.ColumnName) { gc.Visible = true; // int i=dc.Caption.ToString().IndexOf("@"); gc.Caption = dc.Caption; // gc.VisibleIndex =int.Parse(dc.Caption.ToString().Substring(i-1,dc.Caption.Length- i)); gc.AppearanceHeader.Options.UseTextOptions = true; gc.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } } catch { } } //gbi =bandedGridView1.Bands; //gbi.Caption = dc.ColumnName; //gbi.Name = dc.ColumnName; //gbi.AppearanceHeader.Options.UseTextOptions = true; //gbi.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; //gridBand2.Children.Add(gbi); //DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn gridColumn = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn(); //gridColumn.Caption = dc.ColumnName; //gridColumn.FieldName = dc.ColumnName; //gridColumn.Name = "Column" + dc.ColumnName; //gridColumn.Visible = true; //gridColumn.DisplayFormat.FormatString = "n2"; //gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; //bandedGridView1.Columns.Add(gridColumn); //gbi.Columns.Add(gridColumn); } } //if (!isselect) //{ // //barButtonItem4.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; // this.Hide(); // ComponentPrint.ShowPreview(this.gridControl1, this.bandedGridView1.GroupPanelText); // this.Close(); //} //else //{ // title = this.bandedGridView1.GroupPanelText; // this.DialogResult = DialogResult.OK; //} }