/// <summary> /// CreateColumnConfig /// </summary> /// <param name="c"></param> /// <returns></returns> protected ColumnConfig CreateColumnConfig(GridBand c) { var tc = new ColumnConfig(); tc.CopyValueFrom(c); tc.Visible = true; return(tc); }
private int GetColumnBestHeight(GridBand column, int width, DevExpress.Utils.AppearanceObject app) { GridBandInfoArgs ex = null; BandedGridViewInfo viewInfo = GridView.GetViewInfo() as BandedGridViewInfo; viewInfo.GInfo.AddGraphics(null); ex = new GridBandInfoArgs(null, viewInfo.GInfo.Cache); try { ex.InnerElements.Add(new DrawElementInfo(new GlyphElementPainter(), new GlyphElementInfoArgs(viewInfo.View.Images, 0, null), StringAlignment.Near)); ex.SetAppearance(app); ex.Caption = column.Caption; ex.CaptionRect = new Rectangle(0, 0, (int)(width - 10 * DpiXRel), 1000); } finally { viewInfo.GInfo.ReleaseGraphics(); } GraphicsInfo grInfo = new GraphicsInfo(); grInfo.AddGraphics(null); ex.Cache = grInfo.Cache; int Height = CalcCaptionTextSize(grInfo.Cache, ex as HeaderObjectInfoArgs, column.Caption); return(Height); }
public void CreateSizeGrid(DevExpress.XtraGrid.GridControl gridControl, BandedGridView gridView, DataTable dt) { //gridControl.Hide(); gridView.BeginDataUpdate(); try { bool flag = false; gridView.OptionsView.ShowGroupPanel = false; gridView.OptionsView.AllowCellMerge = true; gridView.Columns.Clear(); gridView.Bands.Clear(); gridView.OptionsView.ShowColumnHeaders = false; gridView.OptionsView.ColumnAutoWidth = false; DevExpress.XtraGrid.Views.BandedGrid.GridBand[] band_parent = new DevExpress.XtraGrid.Views.BandedGrid.GridBand[dt.Columns.Count]; DevExpress.XtraGrid.Views.BandedGrid.GridBand[] band_child = new DevExpress.XtraGrid.Views.BandedGrid.GridBand[dt.Columns.Count - 2]; int i_arr = 0; for (int i = 0; i < dt.Columns.Count; i++) { //if (i<=1) //{ band_parent[i] = new GridBand() { Caption = dt.Columns[i].ColumnName.ToString() }; gridView.Bands.Add(band_parent[i]); band_parent[i].Columns.Add(new BandedGridColumn() { FieldName = dt.Columns[i].ColumnName.ToString(), Visible = true, Caption = band_parent[i].Caption }); //} // else ////{ // if (!flag) // { // band_parent[i] = new GridBand() { Caption = "COMPONENT INCOMING" }; // gridView.Bands.Add(band_parent[i]); // band_parent[i].Children.Add(new GridBand() { Caption = dt.Columns[i].ColumnName.ToString() }); // band_parent[i].Children[i_arr].Columns.Add(new BandedGridColumn() { FieldName = dt.Columns[i].ColumnName.ToString(), Visible = true, Caption = dt.Columns[i].ColumnName.ToString() }); // i_arr++; // band_parent[i].Children[0].RowCount = 2; // flag = true; // } // else // { // band_parent[band_parent.Count() - 1].Children.Add(new GridBand() { Caption = dt.Columns[i].ColumnName.ToString() }); // band_parent[band_parent.Count() - 1].Children[i_arr].Columns.Add(new BandedGridColumn() { FieldName = dt.Columns[i].ColumnName.ToString(), Visible = true, Caption = dt.Columns[i].ColumnName.ToString() }); // i_arr++; // } ////} } band_parent[0].RowCount = 2; gridView.OptionsView.ColumnAutoWidth = false; } catch (Exception EX) { //throw EX; } gridView.EndDataUpdate(); gridView.ExpandAllGroups(); }
void itemHide_Click(object sender, EventArgs e) { GridBand band = (sender as DevExpress.Utils.Menu.DXMenuItem).Tag as GridBand; band = GetRootBand(band); band.Visible = false; }
private void pri_SetGridBandStyle(GridBand gb) { if (gb != null) { gb.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; } }
private void UpdateColumnOption(BandedGridColumn col, GridBand Owner, bool isEditable = false, bool isFillDown = false, int rowIndex = 0) { col.OwnerBand = Owner; col.OptionsColumn.AllowEdit = isEditable; col.AutoFillDown = isFillDown; col.RowIndex = rowIndex; }
private void SelectCells(GridBand band) { foreach (BandedGridColumn column in band.Columns) { SelectCells(column); } }
public static void RemoveGroupSummaries(this GridBand gridBand) { Debug.Assert(gridBand != null && gridBand.View != null && gridBand.View.GroupSummary != null, "gridBand == null || gridBand.View == null || gridBand.View.GroupSummary==null"); if (gridBand == null || gridBand.View == null || gridBand.View.GroupSummary == null) { return; } gridBand.View.BeginDataUpdate(); try { var gridGroupSummaryItemsToDelete = new List <GridGroupSummaryItem>(); foreach (GridGroupSummaryItem groupSummary in gridBand.View.GroupSummary) { var summarisedColumn = groupSummary.ShowInGroupColumnFooter as BandedGridColumn; if (summarisedColumn != null && gridBand.Columns.Contains(summarisedColumn)) { gridGroupSummaryItemsToDelete.Add(groupSummary); } } foreach (GridGroupSummaryItem gridGroupSummaryItemToDelete in gridGroupSummaryItemsToDelete) { gridBand.View.GroupSummary.Remove(gridGroupSummaryItemToDelete); } } finally { gridBand.View.EndDataUpdate(); } }
public XGridMenuItem(string name, GridColumn column, GridBand band, GridHitInfo hitInfo) { Name = name; Column = column; Band = band; GridHitInfo = hitInfo; }
public static void ColumnBestFitToMaxWidth(this GridBand band) { if (band.Columns.Count == 0) { return; } var newColumnWidth = band.GetMaxColumnWidth(10); if (newColumnWidth.HasValue) { var needsResize = band.NeedsResize(newColumnWidth.Value); if (needsResize) { // Gem. DX: zuerst grid Width setzen, dann alle Cols ausser der letzten, KEIN Begin/End Update machen var gridColumnsInRow0 = band.GetNumberOfVisibleColumnsInRow(0); var newBandWidth = gridColumnsInRow0.Count() * newColumnWidth.Value; band.Resize(newBandWidth); ResizeAllColumnsButLast(gridColumnsInRow0, newColumnWidth.Value); var gridColumnsInRow1 = band.GetNumberOfVisibleColumnsInRow(1); ResizeAllColumnsButLast(gridColumnsInRow1, newColumnWidth.Value); } } }
public static GridColumn GetHitColumn(GridHitInfo hi, GridBand gbFixed, GridBand gbVariable, int offset) { int totalWidth = gbFixed.Width + offset; int colIdx = 0; for (int i = 0; i < gbVariable.Columns.Count; i++) { if (!gbVariable.Columns[i].Visible) { continue; } totalWidth += gbVariable.Columns[i].Width; if (hi.HitPoint.X < totalWidth) { colIdx = i; break; } } if (hi.HitPoint.X > gbFixed.Width + gbVariable.Width + offset) { colIdx = gbVariable.Columns.Count - 1; } return(gbVariable.Columns[colIdx]); }
public static void AddTooltip(this GridBand gridBand, GetTooltip tooltipGetter) { Debug.Assert(gridBand != null && gridBand.View != null, "gridBand == null || gridBand.View == null "); if (gridBand == null || gridBand.View == null) { return; } gridBand.View.BeginDataUpdate(); try { foreach (BandedGridColumn column in gridBand.Columns) { column.ToolTip = tooltipGetter(column.FieldName); } } catch (Exception ex) { throw ex; } finally { gridBand.View.EndDataUpdate(); } }
protected object ItemByPoint(Point pt) { RowInfo currentRowInfo = ViewInfo.GetRowInfoByPoint(pt); if (currentRowInfo != null) { GridBand band = currentRowInfo.Node[0] as GridBand; if (band != null && !band.Visible) { return(band); } BandedGridColumn gridColumn = currentRowInfo.Node[0] as BandedGridColumn; if (gridColumn != null && (!gridColumn.Visible || gridColumn.OwnerBand == null)) { return(gridColumn); } return(null); } else { return(null); } }
private void SetExistingBand(GridBand existingBand) { foreach (var parameter in _columnManagers) { parameter.Value.Parameters.ExistingBand = existingBand; } }
/// <summary> /// GridView数据项拖动管理 /// </summary> /// <param name="gvSource">拖动的源GridView</param> /// <param name="gvTarget">拖动的目标GridView</param> /// <param name="callBack">当拖放完成后的回调函数,第一个参数是拖动的源数据RowIndex,第二个参数是目标RowIndex</param> public GridViewMutilRowDragHelper(GridView gvSource, GridView gvTarget, Action <int, int, int> callBack) { var fieldName = "dragColumnField"; if (!gvSource.Columns.Select(x => x.FieldName).Contains(fieldName)) { if (gvSource is BandedGridView bgv) { DragColumn = new BandedGridColumn(); var band = new GridBand(); band.OptionsBand.AllowMove = false; band.OptionsBand.AllowSize = false; band.OptionsBand.FixedWidth = true; band.Visible = true; band.Width = 20; band.Fixed = FixedStyle.Left; bgv.Bands.Insert(0, band); band.Columns.Add(DragColumn as BandedGridColumn); gvSource.Columns.Add(DragColumn); } else { DragColumn = new GridColumn(); DragColumn.Fixed = FixedStyle.Left; gvSource.Columns.Insert(0, DragColumn); } DragColumn.Width = 20; DragColumn.FieldName = fieldName; DragColumn.Visible = true; DragColumn.VisibleIndex = 0; DragColumn.OptionsColumn.AllowSize = false; DragColumn.OptionsColumn.AllowEdit = false; DragColumn.OptionsColumn.ShowCaption = false; DragColumn.OptionsColumn.FixedWidth = true; DragColumn.OptionsColumn.AllowMove = false; } else { DragColumn = gvSource.Columns.FirstOrDefault(x => x.FieldName == fieldName); } this._gcSource = gvSource.GridControl; this._gvSource = gvSource; this._gvTarget = gvTarget; this._gcTarget = gvTarget.GridControl; this._callBack = callBack; this._gvSource.SelectionChanged += GvSrc_SelectionChanged; this._imgHelper = new DragImageHelper(gvSource); this._timer = new Timer(); _timer.Interval = 200; _timer.Enabled = true; _timer.Tick += _timer_Tick; AllowDrop = true; AllowAutoScroll = true; }
public void AddBand(string name) { GridBand tempBand = new GridBand() { Caption = name, Name = name }; targetView.Bands.Add(tempBand); }
private GridBand GetRootBand(GridBand band) { GridBand Rootband = band; while (Rootband.BandLevel != 0) { Rootband = Rootband.ParentBand; } return(Rootband); }
public static IEnumerable <BandedGridColumn> GetNumberOfVisibleColumnsInRow(this GridBand band, int rowIndex) { foreach (BandedGridColumn column in band.Columns) { if (column.Visible && column.RowIndex == rowIndex) { yield return(column); } } }
public static void SetColumnsVisible(this GridBand band, int rowindex, bool visible) { foreach (BandedGridColumn column in band.Columns) { if (column.RowIndex == rowindex) { column.Visible = visible; } } }
private void itemFixCancel_Click(object sender, EventArgs e) { GridBand band = (sender as DevExpress.Utils.Menu.DXMenuItem).Tag as GridBand; band = GetRootBand(band); for (int i = band.View.Bands.Count - 1; i >= 0; i--) { band.View.Bands[i].Fixed = DevExpress.XtraGrid.Columns.FixedStyle.None; } }
//xóa cộtv trên gridBand public static void clearAllColumn(GridBand gridBand, DevExpress.XtraGrid.Columns.GridColumn cotNhanSu) { gridBand.Width = 250; for (int i = gridBand.Columns.Count - 1; i > 0; i--) { gridBand.Columns.RemoveAt(i); } cotNhanSu.Width = 250; cotNhanSu.Caption = "Nhân sự"; }
private void ОбновитьСтолбцыТаблицы() { this.данныеТаблицыИстории.BeginUpdate(); try { this.данныеТаблицыИстории.Bands.Clear(); this.данныеТаблицыИстории.Columns.Clear(); GridBand band = this.ДобавитьГруппуСтолбцов("Показатели", null); this.ДобавитьСтолбец(band, "Код учреждения", "КодУчреждения", true, true); this.ДобавитьСтолбец(band, "Элемент цепочки", "Учреждение", true, true); this.ДобавитьСтолбец(band, "Форма", "Форма", true, true); base.WindowState = FormWindowState.Maximized; if (this.типПостроения == ТипПостроенияИсторииСборки.ПоСтолбцу) { this.данныеТаблицыИстории.OptionsView.ColumnAutoWidth = true; this.данныеТаблицыИстории.OptionsBehavior.AutoUpdateTotalSummary = true; this.ДобавитьСтолбец(band, "Строка / Ключевое значение", "Строка", true, true); this.ДобавитьСтолбец(band, "Столбец", "Столбец", true, true); this.ДобавитьСтолбецЗначения(band, "Значение", "Значение"); } else { this.данныеТаблицыИстории.OptionsView.ColumnAutoWidth = false; if (this.типПостроения == ТипПостроенияИсторииСборки.ПоСтрокеСИсточником) { this.данныеТаблицыИстории.OptionsView.EnableAppearanceOddRow = false; this.данныеТаблицыИстории.OptionsView.EnableAppearanceEvenRow = false; this.данныеТаблицыИстории.CustomDrawCell += new RowCellCustomDrawEventHandler(this.данныеТаблицыИстории_CustomDrawCell); } GridBand band2 = this.ДобавитьГруппуСтолбцов("Значения", null); foreach (СтолбецМетаструктуры метаструктуры in this.списокСтолбцов.Values) { if (this.типПостроения == ТипПостроенияИсторииСборки.ПоСтрокеСИсточником) { GridBand band3 = this.ДобавитьГруппуСтолбцов("Столбец " + метаструктуры.Код, band2); this.ДобавитьСтолбецЗначения(band3, "История", "значение_столбца_" + метаструктуры.Код); this.ДобавитьСтолбецЗначения(band3, "Источник", "значение_столбца_источника_" + метаструктуры.Код); BandedGridColumn column = this.ДобавитьСтолбецЗначения(band3, "Приемник", "значение_столбца_приемника_" + метаструктуры.Код); column.OptionsColumn.AllowMerge = DefaultBoolean.True; column.SummaryItem.SummaryType = SummaryItemType.None; } else { this.ДобавитьСтолбецЗначения(band2, "Столбец " + метаструктуры.Код, "значение_столбца_" + метаструктуры.Код); } } } } catch (Exception exception) { Сообщение.ПоказатьИсключительнуюСитуацию("Ошибка построения таблицы.", exception); } this.данныеТаблицыИстории.EndUpdate(); }
public static void clearFullColumn(DevExpress.XtraGrid.GridControl gridControl,GridBand gridBand, DevExpress.XtraGrid.Columns.GridColumn cotNhanSu) { gridBand.Width = 700; for (int i = gridBand.Columns.Count - 1; i > 0; i--) { gridBand.Columns.RemoveAt(i); } cotNhanSu.Width = 700; cotNhanSu.Caption = "Chưa có điểm theo dỏi nào trong bảng này"; gridControl.DataSource = null; }
private bool GetBandColumnsDefaultOnlyVisibility(GridBand band) { for (int i = 0; i < band.Columns.Count; i++) { if (!((MyBandedGridColumn)band.Columns[i]).DefaultBandColumn && (band.Columns[i]).Visible) { return(false); } } return(true); }
private void ThemGridBand(int i, string maThucDon) { GridBand grid = new GridBand(); BandedGridColumn band_DonGia = new BandedGridColumn(); BandedGridColumn band_SoLuong = new BandedGridColumn(); BandedGridColumn band_ThanhTien = new BandedGridColumn(); grid.Columns.Add(band_DonGia); grid.Columns.Add(band_SoLuong); grid.Columns.Add(band_ThanhTien); bgvThucPham_PhieuCho.Bands.AddRange(new GridBand[] { grid }); bgvThucPham_PhieuCho.Columns.AddRange(new BandedGridColumn[] { band_DonGia, band_SoLuong, band_ThanhTien }); grid.Caption = gvDanhSachThucDon_PhieuCho.GetRowCellValue(i, colNhomTre_ThucDon_PhieuCho).ToString(); grid.AppearanceHeader.Font = new Font("Tahoma", 8, FontStyle.Bold); grid.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; grid.Name = "gridNhomTre_" + maThucDon; band_DonGia.Caption = "Đơn giá"; band_DonGia.Visible = true; band_DonGia.FieldName = "dongia_nhomtre_" + maThucDon; band_DonGia.AppearanceHeader.Font = new Font("Tahoma", 8, FontStyle.Bold); band_DonGia.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; band_DonGia.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; band_DonGia.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; band_DonGia.DisplayFormat.FormatString = "#,###"; band_DonGia.Width = 100; band_SoLuong.Caption = "Số lượng"; band_SoLuong.Visible = true; band_SoLuong.FieldName = "soluong_nhomtre_" + maThucDon; band_SoLuong.AppearanceHeader.Font = new Font("Tahoma", 8, FontStyle.Bold); band_SoLuong.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; band_SoLuong.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; band_SoLuong.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; band_SoLuong.DisplayFormat.FormatString = "0.00"; band_SoLuong.Width = 100; band_ThanhTien.Caption = "Thành tiền"; band_ThanhTien.Visible = true; band_ThanhTien.FieldName = "thanhtien_nhomtre_" + maThucDon; band_ThanhTien.AppearanceHeader.Font = new Font("Tahoma", 8, FontStyle.Bold); band_ThanhTien.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; band_ThanhTien.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; band_ThanhTien.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; band_ThanhTien.DisplayFormat.FormatString = "#,###"; band_ThanhTien.Width = 100; band_ThanhTien.OptionsColumn.ReadOnly = true; band_ThanhTien.OptionsColumn.AllowEdit = false; }
public void UpdateColumnOption(BandedGridColumn col, GridBand Owner, bool isEditable = false, bool isFillDown = false, int rowIndex = 0) { if (col == null || Owner == null) { return; } col.OwnerBand = Owner; col.OptionsColumn.AllowEdit = isEditable; col.AutoFillDown = isFillDown; col.RowIndex = rowIndex; }
void itemShow_Click(object sender, EventArgs e) { GridBand band = (sender as DevExpress.Utils.Menu.DXMenuItem).Tag as GridBand; band = GetRootBand(band); foreach (GridBand b in band.View.Bands) { if (!false.Equals(b.Tag)) { b.Visible = true; } } }
public void UpdateBandStyle(string bandName, bool isFixedWith, int width = -1) { GridBand temp = GetBand(bandName); if (temp != null) { if (width != -1) { temp.Width = width; } temp.OptionsBand.FixedWidth = isFixedWith; } }
private void AddColumn(GridBand band, string fieldName) { BandedGridColumn col = new BandedGridColumn(); col.FieldName = fieldName; col.Visible = true; col.OptionsColumn.AllowEdit = false; col.OptionsColumn.ReadOnly = true; col.OptionsFilter.AllowFilter = false; col.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; gvwBase.Columns.Add(col); col.OwnerBand = band; }
/// <summary> /// Create a new banded column from a grid one /// </summary> /// <param name="column">Given grid column</param> /// <param name="owner">The grid band</param> /// <param name="allowEdit">A variable indicates whether the column is editable</param> /// <returns>The banded grid column</returns> private BandedGridColumn CreateNewColumn(GridColumn column, GridBand owner, bool allowEdit) { BandedGridColumn bandedColumn = new BandedGridColumn(); bandedColumn.Name = column.Name; bandedColumn.Caption = column.Caption; bandedColumn.FieldName = column.FieldName; bandedColumn.Visible = true; bandedColumn.Width = column.Width; bandedColumn.OptionsColumn.AllowEdit = allowEdit; bandedColumn.OwnerBand = owner; return(bandedColumn); }
/// <summary> /// Gibt eine List mit den Bound Gridcolumns eines Bandes zurück /// </summary> /// <returns></returns> public static List <GridColumn> GridBandColumnList(GridBand band) { var gcs = new List <GridColumn>(); foreach (GridColumn gc in band.Columns) { if (gc.UnboundType.Equals(UnboundColumnType.Bound)) { gcs.Add(gc); } } return(gcs); }
private void AddBand() { BandedGridColumn bgc; GridBand grbTenMon, grbSoTrinh; dtMonHoc = oBXL_MonHocTrongKy.GetByLop(pDM_LopInfo.DM_LopID, Program.IDNamHoc, Program.HocKy); grbMonHoc.Children.Clear(); if ((dtMonHoc != null) && (dtMonHoc.Rows.Count > 0)) { foreach (DataRow dr in dtMonHoc.Rows) { // Dinh dang cua grid // Ten mon // SoHocTrinh // L1 | L2 // Begin Add band TenMonHoc grbTenMon = new GridBand(); grbTenMon.RowCount = 2; grbTenMon.AppearanceHeader.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; grbMonHoc.Children.AddRange(new GridBand[] { grbTenMon }); // Begin Add band SoHocTrinh grbSoTrinh = new GridBand(); grbTenMon.Children.Add(grbSoTrinh); for (int i = 1; i <= 2; i++) { dtSinhVien.Columns.Add(dr["DM_MonHocID"].ToString() + "_" + i.ToString(), typeof(float)); dtColEnd++; // Begin Add column DiemLan1 bgc = new BandedGridColumn(); grbSoTrinh.Columns.Add(bgc); SetColumnBandCaption(bgc, "L" + i.ToString(), dr["DM_MonHocID"].ToString() + "_" + i.ToString(), 40, DevExpress.Utils.HorzAlignment.Default, false); bgc.OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False; bgc.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; bgc.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; //bgc.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; bgvDiem.Columns.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[] { bgc }); // End Add column DiemLan1 } SetBandCaption(grbSoTrinh, dr["SoHocTrinh"].ToString(), 80); // End Add band SoHocTrinh SetBandCaption(grbTenMon, dr["TenMonHoc"].ToString(), 80); // End Add band TenMonHoc } } }
protected GridBand AddBand(string caption,object id) { var gridBandVet = new GridBand(); gridBandVet.AppearanceHeader.Font = new Font("Tahoma", 8.25F, FontStyle.Bold); gridBandVet.AppearanceHeader.Options.UseFont = true; gridBandVet.AppearanceHeader.Options.UseTextOptions = true; gridBandVet.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gridBandVet.Caption = caption; gridBandVet.MinWidth = 20; gridBandVet.Name = "gridBand" + id; gridBandVet.Width = 58; GridViewDetail.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; ((PLBandedGridView)GridViewDetail).Bands.AddRange(new[] { gridBandVet }); return gridBandVet; }
/// <summary> /// Tạo band trong lưới /// </summary> private GridBand CreateBand(string caption, int index, int width, FixedStyle fix) { GridBand band = new GridBand(); band.Caption = caption; band.Width = width; band.OptionsBand.FixedWidth = true; band.Fixed = fix; band.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; band.AppearanceHeader.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; band.AppearanceHeader.Options.UseTextOptions = true; return band; }
private void SetupBand(GridBand band) { foreach (BandedGridColumn bandCol in band.Columns) { bandCol.OptionsColumn.AllowGroup = DefaultBoolean.False; bandCol.OptionsColumn.AllowMove = false; bandCol.OptionsColumn.AllowShowHide = false; } }
private static void initGrid(DevExpress.XtraGrid.Columns.GridColumn cotNhanSu, DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView gridView, GridBand gridBandMain) { clearAllColumn(gridBandMain,cotNhanSu); XtraGridSupportExt.IDGridColumn(cotNhanSu, "ID", "TEN_NV", "DM_NHAN_VIEN", "NHAN_SU"); BandedGridColumn colHanNop = gridView.Columns.Add(); colHanNop.Caption = "Hạn nộp"; colHanNop.Visible = true; colHanNop.Width = 150; colHanNop.OptionsColumn.AllowEdit = false; HelpGridColumn.CotPLDate(colHanNop, "HAN_NOP",false); BandedGridColumn colNgayNop = gridView.Columns.Add(); colNgayNop.Caption = "Ngày nộp"; colNgayNop.Visible = true; colNgayNop.Width = 150; colNgayNop.OptionsColumn.AllowEdit = false; HelpGridColumn.CotPLDate(colNgayNop,"NGAY_NOP",false); BandedGridColumn colTaiLieu = gridView.Columns.Add(); colTaiLieu.Caption = "Tài liệu"; colTaiLieu.Visible = true; colTaiLieu.Width = 150; colTaiLieu.OptionsColumn.AllowEdit = false; HelpGridColumn.CotTextLeft(colTaiLieu,"TEN_TAI_LIEU"); gridBandMain.Columns.Add(colHanNop); gridBandMain.Columns.Add(colNgayNop); gridBandMain.Columns.Add(colTaiLieu); }
public void FormatColumnConst() { #region --- field muestra gridview.Columns["Qaqc_blk"].Caption = "Blk"; gridview.Columns["Qaqc_par"].Caption = "Par"; gridview.Columns["Qaqc_mr"].Caption = "Mr"; gridview.Columns["Cod_sample"].Caption = "Cod.Muestra"; gridview.Columns["Qaqc_observation"].Caption = "#"; gridview.Columns["Qaqc_error"].Caption = "."; gridview.Columns["Qaqc_approve"].Caption = "aprobar"; gridview.Columns["Qaqc_review"].Caption = "revisar"; gridview.Columns["Qaqc_status_result"].Caption = "."; // --- Width gridview.Columns["Cod_sample"].Width = 90; gridview.Columns["Qaqc_par"].Width = 40; gridview.Columns["Qaqc_observation"].Width = 25; gridview.Columns["Qaqc_error"].Width = 25; gridview.Columns["Qaqc_approve"].Width = 80; gridview.Columns["Qaqc_review"].Width = 80; gridview.Columns["Qaqc_status_result"].Width = 25; // --- visibility gridview.Columns["Idrecep_sample_detail"].Visible = false; gridview.Columns["Idrecep_sample_detail_elem"].Visible = false; gridview.Columns["Cod_sample"].Visible = true; gridview.Columns["Flag_mri"].Visible = false; gridview.Columns["Qaqc_blk"].Visible = false; gridview.Columns["Qaqc_par"].Visible = true; gridview.Columns["Qaqc_mr"].Visible = false; gridview.Columns["Qaqc_approve"].Visible = true; gridview.Columns["Qaqc_review"].Visible = false; gridview.Columns["Qaqc_observation"].Visible = true; gridview.Columns["Qaqc_text_obs"].Visible = false; gridview.Columns["Qaqc_idretest"].Visible = false; gridview.Columns["Qaqc_error"].Visible = true; gridview.Columns["Qaqc_status_result"].Visible = false; // --- readonly gridview.Columns["Qaqc_par"].OptionsColumn.AllowEdit = false; gridview.Columns["Qaqc_error"].OptionsColumn.AllowEdit = false; gridview.Columns["Qaqc_status_result"].OptionsColumn.AllowEdit = false; // --- add columns to muestra band GridBand gbMuestra = new GridBand(); gbMuestra.Caption = "Muestra"; gbMuestra.Columns.Add(gridview.Columns["Idrecep_sample_detail"]); gbMuestra.Columns.Add(gridview.Columns["Idrecep_sample_detail_elem"]); gbMuestra.Columns.Add(gridview.Columns["Cod_sample"]); gbMuestra.Columns.Add(gridview.Columns["Flag_mri"]); // --- add columns to qaqc band GridBand gbQaqc = new GridBand(); gbQaqc.Caption = "Qaqc"; gbQaqc.Columns.Add(gridview.Columns["Qaqc_blk"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_par"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_mr"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_approve"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_review"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_observation"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_text_obs"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_idretest"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_error"]); gbQaqc.Columns.Add(gridview.Columns["Qaqc_status_result"]); //gridview.Bands.Add(gb); gridview.Bands.Insert(0, gbMuestra); gridview.Bands.Add(gbQaqc); #endregion #region --- field volumen GridBand gbVolumen = new GridBand(); gbVolumen.Caption = "Volumen"; // --- visibility gridview.Columns["volumen1"].Visible = true; // --- add columns gbVolumen.Columns.Add(gridview.Columns["volumen1"]); //gridview.Bands.Add(gb); gridview.Bands.Insert(2, gbVolumen); #endregion #region --- dilution columns GridBand gbDilucion = new GridBand(); gbDilucion.Caption = "Dilución"; gbDilucion.Columns.Add(gridview.Columns["flag_dila1"]); gbDilucion.Columns.Add(gridview.Columns["dilua1"]); gbDilucion.Columns.Add(gridview.Columns["flag_dilb1"]); gbDilucion.Columns.Add(gridview.Columns["dilub1"]); // --- column dilution 1 gridview.Columns["flag_dila1"].Visible = true; gridview.Columns["flag_dila1"].Width = 50; gridview.Columns["dilua1"].Visible = true; gridview.Columns["dilua1"].Width = 60; // --- column dilution 2 gridview.Columns["flag_dilb1"].Visible = true; gridview.Columns["flag_dilb1"].Width = 50; gridview.Columns["dilub1"].Visible = true; gridview.Columns["dilub1"].Width = 60; gridview.Bands.Insert(3, gbDilucion); #endregion #region --- law columns GridBand gbLaw = new GridBand(); gbLaw.Caption = "Ley"; gbLaw.Columns.Add(gridview.Columns["Str_result_analysis"]); // --- column dilution 1 gridview.Columns["Str_result_analysis"].Visible = true; gridview.Columns["Str_result_analysis"].Width = 60; gridview.Columns["Str_result_analysis"].Caption = "Ley"; gridview.Bands.Add(gbLaw); #endregion #region fixed band gbMuestra.Fixed = FixedStyle.Left; gbQaqc.Fixed = FixedStyle.Right; gbLaw.Fixed = FixedStyle.Right; #endregion #region format alignment gridview.Columns["dilua1"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; gridview.Columns["dilub1"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; gridview.Columns["Str_result_analysis"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; #endregion #region images gridview.Columns["Qaqc_approve"].ImageIndex = 0; gridview.Columns["Qaqc_review"].ImageIndex = 0; #endregion #region contents gridview.Columns["Qaqc_par"].ColumnEdit = gridcontrol.RepositoryItems[0]; gridview.Columns["Qaqc_observation"].ColumnEdit = gridcontrol.RepositoryItems[1]; gridview.Columns["Qaqc_error"].ColumnEdit = gridcontrol.RepositoryItems[2]; gridview.Columns["Qaqc_approve"].ColumnEdit = gridcontrol.RepositoryItems[3]; gridview.Columns["Qaqc_review"].ColumnEdit = gridcontrol.RepositoryItems[3]; gridview.Columns["Qaqc_status_result"].ColumnEdit = gridcontrol.RepositoryItems[4]; #endregion #region status column gridview.Columns["Qaqc_approve"].OptionsColumn.AllowSort = DefaultBoolean.False; gridview.Columns["Qaqc_review"].OptionsColumn.AllowSort = DefaultBoolean.False; #endregion }
private void CreateGridViewDetail(string[] fields, string[] caption ,DateTime[]dsNgay ) { //Làm sạch lưới gridViewDetails.Bands.Clear(); int k = 0; int cotphu = 0; int SoCotPhu = 7; string[] CotPhuField = new String[] { "N", "V", "SO", "KL", "TC", "HL","" }; #region 3.0.Các band và cột sử dụng GridBand[] BThu = new GridBand[fields.Length / 2 + 1 + SoCotPhu]; for (k = 0; k < BThu.Length; k++) { BThu[k] = new GridBand(); } GridBand[] BNgay = new GridBand[fields.Length / 2]; GridBand[] BSangChieu = new GridBand[fields.Length * 2]; BandedGridColumn[] BColumn = new BandedGridColumn[fields.Length + 1 + SoCotPhu]; for (k = 0; k < BColumn.Length; k++) { BColumn[k] = new BandedGridColumn(); if (k == 0) { BColumn[k].FieldName = "NAME"; BColumn[k].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending; } else if (k <= fields.Length) { BColumn[k].FieldName = fields[k - 1]; BColumn[k].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; BColumn[k].SummaryItem.DisplayFormat = "{0}"; BColumn[k].FieldName = fields[k - 1]; } else { BColumn[k].FieldName = CotPhuField[cotphu]; BColumn[k].Name = CotPhuField[cotphu]; BColumn[k].OptionsColumn.ReadOnly = true; cotphu++; } } #endregion #region 3.1.Gắn bands và cột lên lưới gridViewDetails.Bands.AddRange(BThu); gridViewDetails.Columns.AddRange(BColumn); for (k = 0; k < gridViewDetails.Columns.Count; k++) { gridViewDetails.Columns[k].Visible = true; gridViewDetails.Columns[k].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } #endregion #region 3.2.Tạo các caption & band chứa band, ... BThu[0].Columns.Add(BColumn[0]); BThu[0].Caption = "Nhân viên"; int tt = 0; for (int i = 1; i < BThu.Length - SoCotPhu; i++) { BNgay[i - 1] = new GridBand(); BThu[i].Children.Add(BNgay[i - 1]); BSangChieu[tt] = new GridBand(); BSangChieu[tt].Caption = "Sáng"; BSangChieu[tt].Width = BSangChieu[tt].Caption.Length; BSangChieu[tt].Columns.Add(BColumn[tt + 1]); BNgay[i - 1].Children.Add(BSangChieu[tt++]); BSangChieu[tt] = new GridBand(); BSangChieu[tt].Caption = "Chiều"; BSangChieu[tt].Width = BSangChieu[tt].Caption.Length; BSangChieu[tt].Columns.Add(BColumn[tt + 1]); BNgay[i - 1].Children.Add(BSangChieu[tt++]); } string[] CotPhuTen = new String[] { "Nghỉ có phép", "Nghỉ không phép", "Số ngày làm việc", "Số ngày không lương","Số ngày trợ cấp", "Số ngày hưởng lương", "" }; int col = 0; for (k = BThu.Length - SoCotPhu; k < BThu.Length; k++) { BThu[k].Name = CotPhuField[col]; BThu[k].Caption = CotPhuTen[col]; BThu[k].Columns.Add(BColumn[tt + 1]); tt++; col++; } #endregion #region 3.3.Gắn các tool lên cột //Nut xoa DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit rep_xoa = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); rep_xoa.Buttons.Add(new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Delete)); rep_xoa.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; BColumn[BColumn.Length - 1].ColumnEdit = rep_xoa; rep_xoa.Buttons[0].Width = 23; BColumn[BColumn.Length - 1].Width = 23; BThu[BThu.Length - 1].Width = 23; BThu[BThu.Length - 1].MinWidth = 23; BThu[BThu.Length - 1].OptionsBand.FixedWidth = true; BThu[BThu.Length - 1].OptionsBand.AllowSize = false; rep_xoa.Click += new EventHandler(rep_xoa_Click); //rep_cbb DevExpress.XtraEditors.Repository.RepositoryItemComboBox rep_cbb = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); rep_cbb.Items.AddRange(new object[] {"N", "V", "4" }); for (k = 1; k <= fields.Length; k++) { BColumn[k].ColumnEdit = rep_cbb; BColumn[k].MinWidth = BSangChieu[k - 1].Caption.Length; BColumn[k].Width = 40; } #endregion #region 3.4.Một số định dạng khác BColumn[0].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Default; BColumn[0].OptionsColumn.ReadOnly = true; BColumn[0].OptionsColumn.AllowEdit = false; BColumn[0].OptionsColumn.AllowFocus = false; gridViewDetails.Columns["KL"].OptionsColumn.AllowFocus = false; gridViewDetails.Columns["TC"].OptionsColumn.AllowFocus = false; gridViewDetails.Columns["N"].OptionsColumn.AllowFocus = false; gridViewDetails.Columns["V"].OptionsColumn.AllowFocus = false; gridViewDetails.Columns["SO"].OptionsColumn.AllowFocus = false; gridViewDetails.Columns["HL"].OptionsColumn.AllowFocus = false; gridViewDetails.Columns["SO"].Width = 40; gridViewDetails.Columns["SO"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; gridViewDetails.Columns["KL"].Width = 40; gridViewDetails.Columns["KL"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; gridViewDetails.Columns["V"].Width = 40; gridViewDetails.Columns["V"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; gridViewDetails.Columns["N"].Width = 40; gridViewDetails.Columns["N"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; gridViewDetails.Columns["TC"].Width = 40; gridViewDetails.Columns["TC"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; gridViewDetails.Columns["HL"].Width = 45; gridViewDetails.Columns["HL"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; for (k = 2; k <= 7; k++) { BThu[BThu.Length - k].AppearanceHeader.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; } BThu[0].Width = 150; BThu[0].OptionsBand.FixedWidth = true; BThu[0].Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; BThu[BThu.Length - 1].Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Right; for (k = BThu.Length -1 ; k>= BThu.Length - SoCotPhu; k--) { BThu[k].Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Right; } for (k = 0; k < dsNgay.Length; k++) { BThu[k + 1].Caption = HelpDateExt.GetDayOfWeekVN(dsNgay[k]); BNgay[k].Caption = dsNgay[k].ToShortDateString(); } for (k = 0; k < BThu.Length; k++) { BThu[k].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } int l = 0; for (k = 0; k < BNgay.Length; k++) { BNgay[k].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; BSangChieu[l++].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; BSangChieu[l++].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } gridViewDetails.OptionsView.ShowColumnHeaders = false; #endregion }
private static void initGrid(DevExpress.XtraGrid.Columns.GridColumn cotNhanSu, DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView gridView, GridBand gridBandMain) { clearAllColumn(gridBandMain,cotNhanSu); XtraGridSupportExt.IDGridColumn(cotNhanSu, "ID", "TEN_NV", "DM_NHAN_VIEN", "NHAN_SU"); BandedGridColumn colThoiGianBatDau = gridView.Columns.Add(); colThoiGianBatDau.Caption = "Thời gian bắt đầu"; colThoiGianBatDau.Visible = true; colThoiGianBatDau.Width = 150; colThoiGianBatDau.OptionsColumn.AllowEdit = false; HelpGridColumn.CotPLTimeEdit(colThoiGianBatDau, "THOI_GIAN_BAT_DAU"); BandedGridColumn colThoiGianKetThuc = gridView.Columns.Add(); colThoiGianKetThuc.Caption = "Thời gian kết thúc"; colThoiGianKetThuc.Visible = true; colThoiGianKetThuc.Width = 150; colThoiGianKetThuc.OptionsColumn.AllowEdit = false; HelpGridColumn.CotPLTimeEdit(colThoiGianKetThuc, "THOI_GIAN_KET_THUC"); BandedGridColumn colDanhGia = gridView.Columns.Add(); colDanhGia.Caption = "Đánh giá"; colDanhGia.FieldName = "DANH_GIA"; colDanhGia.Visible = true; colDanhGia.Width = 150; colDanhGia.OptionsColumn.AllowEdit = false; gridBandMain.Columns.Add(colThoiGianBatDau); gridBandMain.Columns.Add(colThoiGianKetThuc); gridBandMain.Columns.Add(colDanhGia); }
private void GenColumn(DataTable dtKenh) { var showRtg = CheckRate.Checked; var showNsx = CheckNsx.Checked; var showCt = CheckCT.Checked; foreach (DataRow row in dtKenh.Rows) { var kenh = row["KENH_PHAT"]; var kenhName = row["KENH_PHAT_NAME"].ToString(); var band = new GridBand { Name = string.Format("BandChannel{0}", kenh), Caption = kenhName, Tag = "C" }; band.AppearanceHeader.Font = new System.Drawing.Font(band.AppearanceHeader.Font, System.Drawing.FontStyle.Bold); band.AppearanceHeader.Options.UseFont = true; band.AppearanceHeader.Options.UseTextOptions = true; band.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; var colRate = new BandedGridColumn() { Name = string.Format("{0}{1}",CheckRate.Tag, kenh), Caption = "Rtg%", CustomizationCaption = string.Format("Rtg% {0}", kenhName), Visible = showRtg }; HelpGridColumn.CotCalcEdit(colRate, "RATE" + kenh, 2); var colNsx = new BandedGridColumn() { Name = string.Format("{0}{1}",CheckNsx.Tag, kenh), Caption = "NSX", CustomizationCaption = string.Format("NSX {0}", kenhName), Visible = showNsx }; HelpGridColumn.CotTextLeft(colNsx, "NSX" + kenh); var colCT = new BandedGridColumn() { Name = string.Format("{0}{1}",CheckCT.Tag, kenh), Caption = "Chương trình", CustomizationCaption = string.Format("Chương trình {0}", kenhName), FieldName = "CT" + kenh, Visible = showCt }; HelpGridColumn.CotTextLeft(colCT, "CT" + kenh); band.Columns.Add(colRate); band.Columns.Add(colNsx); band.Columns.Add(colCT); gridViewDetail.Columns.AddRange(new[] {colRate, colCT, colNsx}); gridViewDetail.Bands.Add(band); } }
public static BandedGridColumn CotPLDong(GridControl GridCtrl, BandedGridView Grid, bool isConfirmDelete) { DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit repositoryItemButtonEditDEL = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); repositoryItemButtonEditDEL.AutoHeight = false; repositoryItemButtonEditDEL.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; repositoryItemButtonEditDEL.Buttons.Clear(); repositoryItemButtonEditDEL.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Delete, "", 10, true, true, false, DevExpress.Utils.HorzAlignment.Center, null, new DevExpress.Utils.KeyShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete)))}); repositoryItemButtonEditDEL.Name = "repositoryItemButtonEditDEL"; repositoryItemButtonEditDEL.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; // repositoryItemButtonEditDEL.KeyUp += delegate(object sender, KeyEventArgs e) // { // if (e.KeyData == Keys.Enter) // Grid.DeleteRow(Grid.FocusedRowHandle); // }; repositoryItemButtonEditDEL.Click += delegate(object sender, EventArgs e) { if (isConfirmDelete) { if (PLMessageBox.ShowConfirmMessage("Bạn có muốn xóa dòng này không ?") == DialogResult.Yes) Grid.DeleteRow(Grid.FocusedRowHandle); } else { Grid.DeleteRow(Grid.FocusedRowHandle); } }; GridCtrl.RepositoryItems.Add(repositoryItemButtonEditDEL); BandedGridColumn CotXoa = new BandedGridColumn(); CotXoa.AppearanceHeader.Options.UseTextOptions = true; CotXoa.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; CotXoa.AppearanceCell.Options.UseTextOptions = true; CotXoa.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; CotXoa.Caption = " "; CotXoa.ColumnEdit = repositoryItemButtonEditDEL; CotXoa.Name = "CotXoa"; CotXoa.OptionsColumn.AllowSize = false; CotXoa.OptionsColumn.FixedWidth = true; CotXoa.Visible = true; CotXoa.VisibleIndex = 50; CotXoa.Width = 25; GridBand gridBand = new GridBand(); gridBand.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gridBand.Columns.Add(CotXoa); gridBand.MinWidth = 10; gridBand.Name = "gridBandCotXoa"; gridBand.Caption = " "; gridBand.OptionsBand.AllowSize = false; gridBand.Width = 10; Grid.Bands.Add(gridBand); Grid.Columns.Add(CotXoa); //Grid.Columns.Add(CotXoa); return CotXoa; }
public void FormatColumns() { // --- set groups if (gridview.RowCount > 0) { // --- set groups with columns foreach (KeyValuePair<string, string> kvp in dicGroups) { GridBand gb = new GridBand(); gb.Caption = kvp.Key; for (int col = 0; col < gridview.Columns.Count; col++) { if (gridview.Columns[col].FieldName.Contains(kvp.Value)) gb.Columns.Add(gridview.Columns[col]); } gridview.Bands.Add(gb); } for (int col = 0; col < gridview.Columns.Count; col++) gridview.Columns[col].Caption = gridview.Columns[col].FieldName; // --- set captions in columns foreach (KeyValuePair<string, string> kvp in dicCaptions) { for (int col = 0; col < gridview.Columns.Count; col++) { if (gridview.Columns[col].Caption.Contains(kvp.Key)) gridview.Columns[col].Caption = gridview.Columns[col].Caption.Replace(kvp.Key, kvp.Value); } } // --- set visible bands if (gridview.RowCount > 0) { foreach (KeyValuePair<string, bool> kvp in dicVisibilityGroups) { for (int ban = 0; ban < gridview.Bands.Count; ban++) { if (gridview.Bands[ban].Caption.Contains(kvp.Key)) gridview.Bands[ban].Visible = kvp.Value; } } } // --- set visible columns for (int col = 0; col < gridview.Columns.Count; col++) { foreach (KeyValuePair<string, bool> kvp in dicVisibilityColumns) { if (gridview.Columns[col].Name.Contains(kvp.Key)) gridview.Columns[col].Visible = kvp.Value; } } // --- visibility in columns for (int col = 0; col < gridview.Columns.Count; col++) { foreach (KeyValuePair<string, bool> kvp in dicVisibilityColumns) { if (gridview.Columns[col].Name.Contains(kvp.Key)) gridview.Columns[col].Visible = kvp.Value; } } // --- set columns's width for (int col = 0; col < gridview.Columns.Count; col++) { gridview.Columns[col].Width = 60; } // --- set far alignment (right) foreach (KeyValuePair<string, string> kvp in dicGroups) { for (int col = 0; col < gridview.Columns.Count; col++) { if (gridview.Columns[col].FieldName.Contains(kvp.Value)) gridview.Columns[col].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; } } } }
private void CreateGridMaster() { //Xóa lưới đã tạo trước đó (nếu có) this.gridControlMaster.DataSource = null; this.gridViewMaster.Columns.Clear(); this.gridViewMaster.Bands.Clear(); //Định nghĩa danh sách cột List<BandedGridColumn> columns = new List<BandedGridColumn>(); GridBand bID = CreateBand("ID", 0, 10, FixedStyle.None); BandedGridColumn cID = new BandedGridColumn(); cID.FieldName = "ID"; bID.Columns.Add(cID); cID.VisibleIndex = 0; columns.Add(cID); bID.Visible = false; GridBand bEmp = CreateBand("Nhân viên", 1, 200, FixedStyle.Left); BandedGridColumn cEmp = new BandedGridColumn(); HelpBandedGrid.CotCombobox((GridColumn)cEmp, "DM_NHAN_VIEN", "ID", "NAME", "EMP_ID", "1=1"); bEmp.Columns.Add(cEmp); cEmp.VisibleIndex = 1; columns.Add(cEmp); cEmp.OptionsColumn.AllowEdit = false; cEmp.OptionsColumn.AllowFocus = false; cEmp.OptionsColumn.ReadOnly = true; GridBand bNghiCoPhep = CreateBand("Nghỉ có phép", 63, 50, FixedStyle.None); BandedGridColumn cNghiCoPhep = new BandedGridColumn(); HelpBandedGrid.CotCalcEdit(cNghiCoPhep, "NGHI_CO_PHEP", 2); bNghiCoPhep.Columns.Add(cNghiCoPhep); cNghiCoPhep.VisibleIndex = 63; columns.Add(cNghiCoPhep); GridBand bNghiKoPhep = CreateBand("Nghỉ không phép", 64, 50, FixedStyle.None); BandedGridColumn cNghiKoPhep = new BandedGridColumn(); HelpBandedGrid.CotCalcEdit(cNghiKoPhep, "NGHI_KHONG_PHEP", 2); bNghiKoPhep.Columns.Add(cNghiKoPhep); cNghiKoPhep.VisibleIndex = 64; cNghiKoPhep.Caption = ""; columns.Add(cNghiKoPhep); GridBand bSoNgay = CreateBand("Số ngày làm việc", 65, 50, FixedStyle.None); BandedGridColumn cSoNgay = new BandedGridColumn(); HelpBandedGrid.CotCalcEdit(cSoNgay, "SO_NGAY_LAM_VIEC", 2); bSoNgay.Columns.Add(cSoNgay); cSoNgay.VisibleIndex = 65; cSoNgay.Caption = ""; columns.Add(cSoNgay); GridBand bKhongLuong = CreateBand("Số ngày không lương", 66, 50, FixedStyle.None); BandedGridColumn cKhongLuong = new BandedGridColumn(); HelpBandedGrid.CotCalcEdit(cKhongLuong, "SO_NGAY_KHONG_LUONG", 2); bKhongLuong.Columns.Add(cKhongLuong); cKhongLuong.VisibleIndex = 66; cKhongLuong.Caption = ""; columns.Add(cKhongLuong); GridBand bTroCap = CreateBand("Số ngày trợ cấp", 67, 50, FixedStyle.None); BandedGridColumn cTroCap = new BandedGridColumn(); HelpBandedGrid.CotCalcEdit(cTroCap, "SO_NGAY_TRO_CAP", 2); bTroCap.Columns.Add(cTroCap); cTroCap.VisibleIndex = 67; cTroCap.Caption = ""; columns.Add(cTroCap); GridBand bHuongLuong = CreateBand("Số ngày hưởng lương", 68, 50, FixedStyle.None); BandedGridColumn cHuongLuong = new BandedGridColumn(); HelpBandedGrid.CotCalcEdit(cHuongLuong, "SO_NGAY_HUONG_LUONG", 2); bHuongLuong.Columns.Add(cHuongLuong); cHuongLuong.VisibleIndex = 68; columns.Add(cHuongLuong); cHuongLuong.Caption = ""; //Định nghĩa danh sách các ngày trong tháng được chọn List<GridBand> bNgay = new List<GridBand>(); int cntIndex = 1; //Lấy ngày đầu tiên của tháng được chọn (Tạm thời chưa có control Filter nên lấy tạm tháng hiện tại) DateTime dateFirstMonth = HelpDate.GetStartOfMonth(dateThangNam._getMorth(), dateThangNam._getYear()); int daysInMonth = CountDateInMonth(dateThangNam._getMorth(), dateThangNam._getYear()); DevExpress.XtraEditors.Repository.RepositoryItemComboBox rep_cbb = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); rep_cbb.Items.AddRange(new object[] { "N", "V", "4" }); for (int i = 1; i <= daysInMonth; i++) { //Band thứ GridBand bItem = new GridBand(); bItem.Caption = GetThuVN(dateFirstMonth.DayOfWeek.ToString()); bItem.Name = "N" + ((i > 9) ? i.ToString() : ("0" + i)); bItem.Width = 100; bItem.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; bItem.AppearanceHeader.Options.UseTextOptions = true; bItem.OptionsBand.FixedWidth = true; bItem.OptionsBand.AllowSize = false; bNgay.Add(bItem); //Band ngày/tháng/năm GridBand bDate = new GridBand(); bDate.Caption = dateFirstMonth.Date.ToShortDateString(); bDate.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; bDate.AppearanceHeader.Options.UseTextOptions = true; bItem.Children.Add(bDate); //Cột sáng, chiều GridBand bSang = CreateBand("Sáng", 0, 50, FixedStyle.None); BandedGridColumn cSang = new BandedGridColumn(); cSang.VisibleIndex = ++cntIndex; cSang.FieldName = "N" + ((i > 9) ? i.ToString() : ("0" + i)) + "_SANG"; cSang.ColumnEdit = rep_cbb; bSang.Columns.Add(cSang); columns.Add(cSang); GridBand bChieu = CreateBand("Chiều", 0, 50, FixedStyle.None); BandedGridColumn cChieu = new BandedGridColumn(); cChieu.VisibleIndex = ++cntIndex; cChieu.FieldName = "N" + ((i > 9) ? i.ToString() : ("0" + i)) + "_CHIEU"; cChieu.ColumnEdit = rep_cbb; bChieu.Columns.Add(cChieu); columns.Add(cChieu); bDate.Children.Add(bSang); bDate.Children.Add(bChieu); //Tăng ngày lên dateFirstMonth = dateFirstMonth.AddDays(1); } this.gridViewMaster.Bands.Add(bID); this.gridViewMaster.Bands.Add(bEmp); this.gridViewMaster.Bands.AddRange(bNgay.ToArray()); this.gridViewMaster.Bands.Add(bNghiCoPhep); this.gridViewMaster.Bands.Add(bNghiKoPhep); this.gridViewMaster.Bands.Add(bSoNgay); this.gridViewMaster.Bands.Add(bKhongLuong); this.gridViewMaster.Bands.Add(bTroCap); this.gridViewMaster.Bands.Add(bHuongLuong); this.gridViewMaster.Columns.AddRange(columns.ToArray()); this.gridViewMaster.OptionsView.ShowColumnHeaders = true; }
public AppBienMucGridTemplate(PLBandedGridView gridViewMaster) { this.gridViewMaster = gridViewMaster; #region Declare CotMaBang = new BandedGridColumn(); CotTietMuc = new BandedGridColumn(); CotNoiDung = new BandedGridColumn(); CotSoTap = new BandedGridColumn(); CotTenTap = new BandedGridColumn(); CotTongTap = new BandedGridColumn(); CotSoBang = new BandedGridColumn(); CotLoaiBang = new BandedGridColumn(); CotThonSoLoaiBang = new BandedGridColumn(); CotPostMaster = new BandedGridColumn(); CotPopUp = new BandedGridColumn(); CotSDKCBHD = new BandedGridColumn(); CotTTDinhKem = new BandedGridColumn(); CotTuKhoa = new BandedGridColumn(); CotKHPL = new BandedGridColumn(); CotKHXK = new BandedGridColumn(); CotKe = new BandedGridColumn(); CotNgan = new BandedGridColumn(); CotTang = new BandedGridColumn(); CotSoLanPhat = new BandedGridColumn(); CotPhatLanDau = new BandedGridColumn(); CotThoiHanBanQuyen = new BandedGridColumn(); CotDonViSoHuu = new BandedGridColumn(); CotDonViCungCap = new BandedGridColumn(); CotNuoc = new BandedGridColumn(); CotDoiTuongKhanGia = new BandedGridColumn(); CotRating = new BandedGridColumn(); //CotTimeCode_Betacam_In = new BandedGridColumn(); //CotTimeCode_Beatacam_Out = new BandedGridColumn(); //CotTimeCode_Beatacam_Dur = new BandedGridColumn(); CotNgayNhap = new BandedGridColumn(); CotNguoiNhap = new BandedGridColumn(); CotPhongBan = new BandedGridColumn(); //CotTimeCode_File_In = new BandedGridColumn(); //CotTimeCode_File_Out = new BandedGridColumn(); //CotTimeCode_File_Duration = new BandedGridColumn(); CotGhiChu = new BandedGridColumn(); CotNgayMuon = new BandedGridColumn(); CotNgayTra = new BandedGridColumn(); CotDoiTuongMuon = new BandedGridColumn(); CotThongTinMuon = new BandedGridColumn(); CotNoiLuuTru = new BandedGridColumn(); CotTenGoc = new BandedGridColumn(); CotNamSX = new BandedGridColumn(); CotThoiLuong = new BandedGridColumn(); CotThanhLy = new BandedGridColumn(); gridBandThongTinChinh = new GridBand(); gridBandThongTinMuonTra = new GridBand(); gridBandNguonGoc = new GridBand(); gridBandThongTinPhatSong = new GridBand(); gridBandThongTinBetacam = new GridBand(); gridBandThongTinHD = new GridBand(); #endregion #region Init Grid gridViewMaster.Bands.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.GridBand[] { this.gridBandThongTinChinh, this.gridBandThongTinMuonTra, this.gridBandNguonGoc, this.gridBandThongTinPhatSong, this.gridBandThongTinBetacam, this.gridBandThongTinHD}); gridViewMaster.Columns.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[] { this.CotNoiDung, this.CotTietMuc, this.CotMaBang, this.CotTenGoc, this.CotSoTap, this.CotTenTap, this.CotTongTap, this.CotThoiLuong, this.CotSoBang, this.CotLoaiBang, this.CotThonSoLoaiBang, this.CotPostMaster, this.CotPopUp, this.CotSDKCBHD, this.CotTTDinhKem, this.CotTuKhoa, this.CotKHPL, this.CotKHXK, this.CotKe, this.CotNgan, this.CotTang, this.CotSoLanPhat, this.CotPhatLanDau, this.CotThoiHanBanQuyen, this.CotDonViSoHuu, this.CotDonViCungCap, this.CotNamSX, this.CotNuoc, this.CotDoiTuongKhanGia, this.CotRating, //this.CotTimeCode_Betacam_In, //this.CotTimeCode_Beatacam_Out, //this.CotTimeCode_Beatacam_Dur, //this.CotTimeCode_File_In, //this.CotTimeCode_File_Out, //this.CotTimeCode_File_Duration, this.CotNgayNhap, this.CotNguoiNhap, this.CotPhongBan, this.CotGhiChu, this.CotThanhLy, this.CotNgayMuon, this.CotNgayTra, this.CotDoiTuongMuon, this.CotThongTinMuon, this.CotNoiLuuTru}); gridViewMaster.GroupCount = 2; gridViewMaster.SortInfo.AddRange(new DevExpress.XtraGrid.Columns.GridColumnSortInfo[] { new DevExpress.XtraGrid.Columns.GridColumnSortInfo(this.CotNoiDung, DevExpress.Data.ColumnSortOrder.Ascending), new DevExpress.XtraGrid.Columns.GridColumnSortInfo(this.CotSoTap, DevExpress.Data.ColumnSortOrder.Ascending)}); CotNoiDung.GroupIndex = 0; CotPostMaster.GroupIndex = 1; #endregion #region Init Column // // CotTenGoc // this.CotTenGoc.Caption = "Tên gốc"; this.CotTenGoc.Name = "CotTenGoc"; this.CotTenGoc.Width = 58; // // CotMaBang // this.CotMaBang.Caption = "Mã băng"; this.CotMaBang.Name = "CotMaBang"; this.CotMaBang.Width = 58; // // CotTietMuc // this.CotTietMuc.Caption = "Tiết mục"; this.CotTietMuc.Name = "CotTietMuc"; this.CotTietMuc.Width = 65; // // CotNoiDung // this.CotNoiDung.Caption = "Nội dung"; this.CotNoiDung.Name = "CotNoiDung"; this.CotNoiDung.Width = 67; // // CotSoTap // this.CotSoTap.Caption = "Tập số"; this.CotSoTap.Name = "CotSoTap"; this.CotSoTap.Width = 58; // // CotTenTap // this.CotTenTap.Caption = "Tên tập"; this.CotTenTap.Name = "CotTenTap"; this.CotTenTap.Width = 58; // // CotTongTap // this.CotTongTap.Caption = "Tổng tập"; this.CotTongTap.Name = "CotTongTap"; this.CotTongTap.Width = 58; // // CotThoiLuong // this.CotThoiLuong.Caption = "Thời lượng"; this.CotThoiLuong.Name = "CotThoiLuong"; this.CotThoiLuong.Width = 62; // // CotSoBang // this.CotSoBang.Caption = "Số băng"; this.CotSoBang.Name = "CotSoBang"; this.CotSoBang.Width = 58; // // CotLoaiBang // this.CotLoaiBang.Caption = "Loại lưu trữ"; this.CotLoaiBang.Name = "CotLoaiBang"; this.CotLoaiBang.Width = 67; // // CotThonSoLoaiBang // this.CotThonSoLoaiBang.Caption = "Thông số loại băng"; this.CotThonSoLoaiBang.Name = "CotThonSoLoaiBang"; this.CotThonSoLoaiBang.Width = 102; // // CotPostMaster // this.CotPostMaster.Caption = "Post/Master"; this.CotPostMaster.Name = "CotPostMaster"; this.CotPostMaster.Width = 61; // // CotPopUp // this.CotPopUp.Caption = "Pop Up"; this.CotPopUp.Name = "CotPopUp"; this.CotPopUp.Width = 58; // // CotKe // this.CotKe.Caption = "Kệ"; this.CotKe.Name = "CotKe"; this.CotKe.Width = 58; // // CotNgan // this.CotNgan.Caption = "Ngăn"; this.CotNgan.Name = "CotNgan"; this.CotNgan.Width = 58; // // CotTang // this.CotTang.Caption = "Tầng"; this.CotTang.Name = "CotTang"; this.CotTang.Width = 58; // // CotKHPL // this.CotKHPL.Caption = "KHPL"; this.CotKHPL.Name = "CotKHPL"; this.CotKHPL.ToolTip = "Ký hiệu phân loại"; this.CotKHPL.Width = 36; // // CotKHXK // this.CotKHXK.Caption = "KHXK"; this.CotKHXK.Name = "CotKHXK"; this.CotKHXK.ToolTip = "Ký hiệu xếp kho"; this.CotKHXK.Width = 37; // // CotTTDinhKem // this.CotTTDinhKem.Caption = "Thông tin đính kèm"; this.CotTTDinhKem.Name = "CotTTDinhKem"; this.CotTTDinhKem.Width = 102; // // CotTuKhoa // this.CotTuKhoa.Caption = "Từ khóa"; this.CotTuKhoa.Name = "CotTuKhoa"; this.CotTuKhoa.Width = 51; // // CotDoiTuongKhanGia // this.CotDoiTuongKhanGia.Caption = "Đối tượng khán giả"; this.CotDoiTuongKhanGia.Name = "CotDoiTuongKhanGia"; this.CotDoiTuongKhanGia.Width = 103; // // CotRating // this.CotRating.Caption = "Rating trung bình (%)"; this.CotRating.Name = "CotRating"; this.CotRating.Width = 117; // // CotNgayNhap // this.CotNgayNhap.Caption = "Ngày nhập"; this.CotNgayNhap.Name = "CotNgayNhap"; this.CotNgayNhap.Width = 64; // // CotNguoiNhap // this.CotNguoiNhap.Caption = "Người nhập"; this.CotNguoiNhap.Name = "CotNguoiNhap"; this.CotNguoiNhap.Width = 64;// // CotPhongBan // this.CotPhongBan.Caption = "Phòng ban"; this.CotPhongBan.Name = "CotPhongBan"; this.CotPhongBan.Width = 64; // // CotGhiChu // this.CotGhiChu.Caption = "Ghi chú"; this.CotGhiChu.Name = "CotGhiChu"; this.CotGhiChu.Width = 58; // // CotNgayMuon // this.CotNgayMuon.Caption = "Ngày mượn"; this.CotNgayMuon.Name = "CotNgayMuon"; this.CotNgayMuon.Width = 67; // // CotNgayTra // this.CotNgayTra.Caption = "Ngày trả"; this.CotNgayTra.Name = "CotNgayTra"; this.CotNgayTra.Width = 67; // // CotDoiTuongMuon // this.CotDoiTuongMuon.Caption = "Đối tượng mượn"; this.CotDoiTuongMuon.Name = "CotDoiTuongMuon"; this.CotDoiTuongMuon.Width = 90; // // CotThongTinMuon // this.CotThongTinMuon.Caption = "Thông tin mượn"; this.CotThongTinMuon.Name = "CotThongTinMuon"; this.CotThongTinMuon.Width = 87; // // CotNamSX // this.CotNamSX.Caption = "Năm SX"; this.CotNamSX.Name = "CotNamSX"; this.CotNamSX.Width = 48; // // CotDonViCungCap // this.CotDonViCungCap.Caption = "Đơn vị cung cấp"; this.CotDonViCungCap.Name = "CotDonViCungCap"; this.CotDonViCungCap.Width = 89; // // CotDonViSoHuu // this.CotDonViSoHuu.Caption = "Đơn vị sở hữu"; this.CotDonViSoHuu.Name = "CotDonViSoHuu"; this.CotDonViSoHuu.Width = 79; // // CotNuoc // this.CotNuoc.Caption = "Nước SX"; this.CotNuoc.Name = "CotNuoc"; this.CotNuoc.ToolTip = "Nước sản xuất"; this.CotNuoc.Width = 52; // // CotThoiHanBangQuyen // this.CotThoiHanBanQuyen.Caption = "Thời hạn bản quyền"; this.CotThoiHanBanQuyen.Name = "CotThoiHanBangQuyen"; this.CotThoiHanBanQuyen.Width = 107; // // CotSoLanPhat // this.CotSoLanPhat.Caption = "Tồng số lần đã phát"; this.CotSoLanPhat.Name = "CotSoLanPhat"; this.CotSoLanPhat.Width = 107; // // CotPhatLanDau // this.CotPhatLanDau.Caption = "Ngày phát đầu tiên"; this.CotPhatLanDau.Name = "CotPhatLanDau"; this.CotPhatLanDau.ToolTip = "Những ngày phát lần đầu tương ứng trên các đài"; this.CotPhatLanDau.Width = 104; // // CotTimeCode_Betacam_In //// //this.CotTimeCode_Betacam_In.Caption = "Timecode in (betacam)"; //this.CotTimeCode_Betacam_In.Name = "CotTimeCode_Betacam_In"; //this.CotTimeCode_Betacam_In.Width = 120; //// //// CotTimeCode_Beatacam_Out //// //this.CotTimeCode_Beatacam_Out.Caption = "Timecode out (betacam)"; //this.CotTimeCode_Beatacam_Out.Name = "CotTimeCode_Beatacam_Out"; //this.CotTimeCode_Beatacam_Out.Width = 128; //// //// CotTimeCode_Beatacam_Dur //// //this.CotTimeCode_Beatacam_Dur.Caption = "Timecode dur (betacam)"; //this.CotTimeCode_Beatacam_Dur.Name = "CotTimeCode_Beatacam_Dur"; //this.CotTimeCode_Beatacam_Dur.Width = 128; //// //// CotTimeCode_File_In //// //this.CotTimeCode_File_In.Caption = "Timecode in (file)"; //this.CotTimeCode_File_In.Name = "CotTimeCode_File_In"; //this.CotTimeCode_File_In.Width = 93; //// //// CotTimeCode_File_Out //// //this.CotTimeCode_File_Out.Caption = "Timecode out (file)"; //this.CotTimeCode_File_Out.Name = "CotTimeCode_File_Out"; //this.CotTimeCode_File_Out.Width = 101; //// //// CotTimeCode_File_Duration //// //this.CotTimeCode_File_Duration.Caption = "Timcode dur (file)"; //this.CotTimeCode_File_Duration.Name = "CotTimeCode_File_Duration"; //this.CotTimeCode_File_Duration.Width = 95; // // CotSDKCBHD // this.CotSDKCBHD.Caption = "Số ĐKCB HD"; this.CotSDKCBHD.Name = "CotSDKCBHD"; this.CotSDKCBHD.ToolTip = "Số đăng ký cá biệt ổ cứng"; this.CotSDKCBHD.Width = 71; // // CotNoiLuuTru // this.CotNoiLuuTru.Caption = "Nơi lưu trữ"; this.CotNoiLuuTru.FieldName = "CotNoiLuuTru"; this.CotNoiLuuTru.Name = "CotNoiLuuTru"; this.CotNoiLuuTru.Width = 63; // // CotThanhLy // this.CotThanhLy.Caption = "Thanh lý"; this.CotThanhLy.Name = "CotThanhLy"; #endregion #region Init Band // // gridBandThongTinChinh // this.gridBandThongTinChinh.AppearanceHeader.Options.UseTextOptions = true; this.gridBandThongTinChinh.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.gridBandThongTinChinh.Caption = "Thông tin chính"; this.gridBandThongTinChinh.Columns.Add(this.CotNoiDung); this.gridBandThongTinChinh.Columns.Add(this.CotTenGoc); this.gridBandThongTinChinh.Columns.Add(this.CotMaBang); this.gridBandThongTinChinh.Columns.Add(this.CotTietMuc); this.gridBandThongTinChinh.Columns.Add(this.CotSoTap); this.gridBandThongTinChinh.Columns.Add(this.CotTenTap); this.gridBandThongTinChinh.Columns.Add(this.CotTongTap); this.gridBandThongTinChinh.Columns.Add(this.CotThoiLuong); this.gridBandThongTinChinh.Columns.Add(this.CotSoBang); this.gridBandThongTinChinh.Columns.Add(this.CotLoaiBang); this.gridBandThongTinChinh.Columns.Add(this.CotThonSoLoaiBang); this.gridBandThongTinChinh.Columns.Add(this.CotPostMaster); this.gridBandThongTinChinh.Columns.Add(this.CotPopUp); this.gridBandThongTinChinh.Columns.Add(this.CotKe); this.gridBandThongTinChinh.Columns.Add(this.CotNgan); this.gridBandThongTinChinh.Columns.Add(this.CotTang); this.gridBandThongTinChinh.Columns.Add(this.CotKHPL); this.gridBandThongTinChinh.Columns.Add(this.CotKHXK); this.gridBandThongTinChinh.Columns.Add(this.CotTTDinhKem); this.gridBandThongTinChinh.Columns.Add(this.CotTuKhoa); this.gridBandThongTinChinh.Columns.Add(this.CotDoiTuongKhanGia); this.gridBandThongTinChinh.Columns.Add(this.CotRating); this.gridBandThongTinChinh.Columns.Add(this.CotNgayNhap); this.gridBandThongTinChinh.Columns.Add(this.CotNguoiNhap); this.gridBandThongTinChinh.Columns.Add(this.CotPhongBan); this.gridBandThongTinChinh.Columns.Add(this.CotGhiChu); this.gridBandThongTinChinh.Columns.Add(this.CotThanhLy); this.gridBandThongTinChinh.Name = "gridBandThongTinChinh"; this.gridBandThongTinChinh.Width = 58; // // gridBandThongTinMuonTra // this.gridBandThongTinMuonTra.AppearanceHeader.Options.UseTextOptions = true; this.gridBandThongTinMuonTra.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.gridBandThongTinMuonTra.Caption = "Thông tin mượn trả"; this.gridBandThongTinMuonTra.Columns.Add(this.CotNgayMuon); this.gridBandThongTinMuonTra.Columns.Add(this.CotNgayTra); this.gridBandThongTinMuonTra.Columns.Add(this.CotDoiTuongMuon); this.gridBandThongTinMuonTra.Columns.Add(this.CotThongTinMuon); this.gridBandThongTinMuonTra.Name = "gridBandThongTinMuonTra"; this.gridBandThongTinMuonTra.Width = 87; // // gridBandNguonGoc // this.gridBandNguonGoc.AppearanceHeader.Options.UseTextOptions = true; this.gridBandNguonGoc.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.gridBandNguonGoc.Caption = "Nguồn gốc"; this.gridBandNguonGoc.Columns.Add(this.CotNamSX); this.gridBandNguonGoc.Columns.Add(this.CotDonViCungCap); this.gridBandNguonGoc.Columns.Add(this.CotDonViSoHuu); this.gridBandNguonGoc.Columns.Add(this.CotNuoc); this.gridBandNguonGoc.Columns.Add(this.CotThoiHanBanQuyen); this.gridBandNguonGoc.Name = "gridBandNguonGoc"; this.gridBandNguonGoc.Width = 52; // // gridBandThongTinPhatSong // this.gridBandThongTinPhatSong.AppearanceHeader.Options.UseTextOptions = true; this.gridBandThongTinPhatSong.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.gridBandThongTinPhatSong.Caption = "Thông tin phát sóng"; this.gridBandThongTinPhatSong.Columns.Add(this.CotSoLanPhat); this.gridBandThongTinPhatSong.Columns.Add(this.CotPhatLanDau); this.gridBandThongTinPhatSong.Name = "gridBandThongTinPhatSong"; this.gridBandThongTinPhatSong.Width = 104; // // gridBandThongTinBetacam // this.gridBandThongTinBetacam.AppearanceHeader.Options.UseTextOptions = true; this.gridBandThongTinBetacam.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.gridBandThongTinBetacam.Caption = "Thông tin Timecode"; //this.gridBandThongTinBetacam.Columns.Add(this.CotTimeCode_Betacam_In); //this.gridBandThongTinBetacam.Columns.Add(this.CotTimeCode_Beatacam_Out); //this.gridBandThongTinBetacam.Columns.Add(this.CotTimeCode_Beatacam_Dur); //this.gridBandThongTinBetacam.Columns.Add(this.CotTimeCode_File_In); //this.gridBandThongTinBetacam.Columns.Add(this.CotTimeCode_File_Out); //this.gridBandThongTinBetacam.Columns.Add(this.CotTimeCode_File_Duration); this.gridBandThongTinBetacam.Name = "gridBandThongTinBetacam"; this.gridBandThongTinBetacam.Width = 95; // // gridBandThongTinHD // this.gridBandThongTinHD.AppearanceHeader.Options.UseTextOptions = true; this.gridBandThongTinHD.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.gridBandThongTinHD.Caption = "Thông tin HD (File)"; this.gridBandThongTinHD.Columns.Add(this.CotSDKCBHD); this.gridBandThongTinHD.Columns.Add(this.CotNoiLuuTru); this.gridBandThongTinHD.Name = "gridBandThongTinHD"; this.gridBandThongTinHD.Width = 63; #endregion }
public static BandedGridColumn ThemCot(GridBand band, string Caption, int VisibleIndex, int Width) { BandedGridColumn Column = new BandedGridColumn(); Column.Caption = Caption; Column.Name = Caption; if (VisibleIndex != -2) { if (VisibleIndex == -1) { Column.Visible = false; Column.OptionsColumn.AllowFocus = false; Column.OptionsColumn.ReadOnly = true; Column.OptionsColumn.AllowEdit = false; Column.Width = 0; Column.OptionsColumn.FixedWidth = true; Column.OptionsColumn.ShowInCustomizationForm = false; Column.OptionsColumn.AllowShowHide = false; Column.OptionsFilter.AllowFilter = false; } else Column.VisibleIndex = VisibleIndex; } if (Width != -1) { Column.Width = Width; } band.View.Columns.Add(Column); band.Columns.Add(Column); return Column; }
private bool IsFixedBand(GridBand band) { return (band == gridBandEmployee) || (band == gridBandInfo); }
private void InitData() { Ps_YearRange py = new Ps_YearRange(); py.Col4 = yearflag; py.Col5 = projectUID; IList<Ps_YearRange> li = Itop.Client.Common.Services.BaseService.GetList<Ps_YearRange>("SelectPs_YearRangeByCol5andCol4", py); if (li.Count > 0) { firstyear = li[0].StartYear; endyear = li[0].FinishYear; } else { firstyear = 2000; endyear = 2008; py.BeginYear = 1990; py.FinishYear = endyear; py.StartYear = firstyear; py.EndYear = 2060; py.ID = Guid.NewGuid().ToString(); Itop.Client.Common.Services.BaseService.Create<Ps_YearRange>(py); } DataTable dt = new DataTable(); dt.Columns.Add("ID"); dt.Columns.Add("Title"); Ps_History psp_Type = new Ps_History(); psp_Type.Forecast = pstype; psp_Type.Col4 = projectUID; IList<Ps_History> listTypes = Common.Services.BaseService.GetList<Ps_History>("SelectPs_HistoryByForecast", psp_Type); DataTable dataTable = Itop.Common.DataConverter.ToDataTable((IList)listTypes, typeof(Ps_History)); DataRow[] rows1 = dataTable.Select("Title like 'ȫ����õ���%'"); if (rows1.Length==0) { MessageBox.Show("ȱ�١�ȫ����õ����� ����,������ͳ��!"); this.Close(); return; } string pid = rows1[0]["ID"].ToString(); string tempTite=rows1[0]["Title"].ToString(); //ȡ�������еĵ�λ Untis = Historytool.FindUnits(tempTite); DataRow[] rows3 = dataTable.Select("ParentID='"+pid+"'"); if (rows3.Length==0) { MessageBox.Show("ȱ�١�ȫ����õ������µķ���ҵ�õ�����,������ͳ��!"); this.Close(); return; } int m=-1; for (int i = firstyear; i <= endyear; i++) { if (!ht.ContainsValue(i)) continue; m++; dt.Columns.Add("y" + i, typeof(double)); dt.Columns.Add("n" + i, typeof(double)); GridBand gb = new GridBand(); gb.Caption = i + "��"; gb.AppearanceHeader.Options.UseTextOptions = true; gb.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.bandedGridView1.Bands.Add(gb); GridBand gb1 = new GridBand(); if (Untis.Length>0) { gb1.Caption = "�õ���("+Untis+")"; } else { gb1.Caption = "�õ���"; } gb1.AppearanceHeader.Options.UseTextOptions = true; gb1.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gb.Children.Add(gb1); GridBand gb2 = new GridBand(); gb2.Caption = "�ٷֱ�"; gb2.AppearanceHeader.Options.UseTextOptions = true; gb2.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gb.Children.Add(gb2); BandedGridColumn gridColumn = new BandedGridColumn(); gridColumn.Caption = i+"���õ���"; gridColumn.FieldName = "y" + i; gridColumn.Visible = true; gridColumn.VisibleIndex = 2*m+10; gridColumn.DisplayFormat.FormatString = "n2"; gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; gridColumn.Width = 95; gb1.Columns.Add(gridColumn); BandedGridColumn gridColumn1 = new BandedGridColumn(); gridColumn1.Caption = i+"��ٷֱ�"; gridColumn1.FieldName = "n" + i; gridColumn1.Visible = true; gridColumn1.VisibleIndex = 2 * m + 11; gridColumn1.DisplayFormat.FormatString = "n2"; gridColumn1.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; gridColumn1.Width = 80; gb2.Columns.Add(gridColumn1); } double sum = 0; try { sum = Convert.ToDouble(rows1[0]["y" + firstyear]); } catch { } DataRow row1 = dt.NewRow(); row1["ID"] = Guid.NewGuid().ToString(); row1["Title"] = "�õ����ܼ�";//rows1[0]["Title"].ToString(); for (int k = 0; k < rows3.Length; k++) { DataRow row = dt.NewRow(); row["ID"] = Guid.NewGuid().ToString(); row["Title"] = rows3[k]["Title"].ToString(); for (int j = firstyear; j <= endyear; j++) { if (!ht.ContainsValue(j)) continue; sum = 0; try { sum = Convert.ToDouble(rows1[0]["y" + j]); } catch { } row1["y" + j] = sum; row1["n" + j] = 1; double sum1 = 0; double sum2 = 0; try { sum1 = Convert.ToDouble(rows3[k]["y" + j]); } catch { } row["y" + j] = sum1; if (sum != 0) sum2 = sum1 / sum; row["n" + j] = sum2; } dt.Rows.Add(row); } dt.Rows.Add(row1); this.gridControl1.DataSource = dt; }
private void CotPLDong() { var repositoryItemButtonEditDEL = new RepositoryItemButtonEdit { AutoHeight = false, BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder }; repositoryItemButtonEditDEL.Buttons.AddRange(new[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Delete, "", 10, true, true, false, DevExpress.Utils.HorzAlignment.Center, null, new DevExpress.Utils.KeyShortcut((Keys.Control | Keys.Delete)))}); repositoryItemButtonEditDEL.Name = "repositoryItemButtonEditDEL"; repositoryItemButtonEditDEL.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; // repositoryItemButtonEditDEL.KeyUp += delegate(object sender, KeyEventArgs e) // { // if (e.KeyData == Keys.Enter) // Grid.DeleteRow(Grid.FocusedRowHandle); // }; repositoryItemButtonEditDEL.ButtonClick += delegate { DataRow row = gridViewBienMuc.GetFocusedDataRow(); if (row == null) return; string message = "Bạn có muốn xóa dòng này không ?"; if (_postMaster.IS_DELETE == "Y") message = "Thực hiện thao tác này sẽ không thể phục hồi lại được!\nBạn có chắc là muốn xóa hẳn biên mục này?"; if (HelpMsgBox.ShowConfirmMessage(message) == DialogResult.No) return; if (_postMaster.IS_DELETE != "Y" && row[BIEN_MUC.BM_ID].ToString() != "") { row[BIEN_MUC.IS_DELETE] = "Y"; row.Table.DefaultView.RowFilter = BIEN_MUC.IS_DELETE + "<>'Y'"; } else { if (_postMaster.IS_DELETE == "Y") { if (DABienMuc.I.Delete(HelpNumber.ParseInt64(row[BIEN_MUC.BM_ID])) == false) HelpMsgBox.ShowNotificationMessage("Xóa biên mục không thành công!"); else gridViewBienMuc.DeleteRow(gridViewBienMuc.FocusedRowHandle); } else { gridViewBienMuc.DeleteRow(gridViewBienMuc.FocusedRowHandle); } } }; gridControlBienMuc.RepositoryItems.Add(repositoryItemButtonEditDEL); _cotXoa = new BandedGridColumn(); _cotXoa.AppearanceHeader.Options.UseTextOptions = true; _cotXoa.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; _cotXoa.AppearanceCell.Options.UseTextOptions = true; _cotXoa.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; _cotXoa.Caption = " "; _cotXoa.ColumnEdit = repositoryItemButtonEditDEL; _cotXoa.Name = "CotXoa"; _cotXoa.OptionsColumn.AllowSize = false; _cotXoa.OptionsColumn.FixedWidth = true; _cotXoa.Visible = true; _cotXoa.VisibleIndex = 0; _cotXoa.Width = 25; var gridBand = new GridBand(); gridBand.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gridBand.Columns.Add(_cotXoa); gridBand.MinWidth = 10; gridBand.Name = "gridBandCotXoa"; gridBand.Caption = " "; gridBand.OptionsBand.AllowSize = false; gridBand.Width = 10; gridViewBienMuc.Bands.Add(gridBand); gridViewBienMuc.Columns.Add(_cotXoa); }