private void gridView1_CustomDrawRowFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { GridView view = (GridView)sender; if (e.Column.FieldName == "HP") { if (e.RowHandle % 2 == 0) { e.Info.DisplayText = string.Format("Total: {0}", view.GetGroupSummaryValue(e.RowHandle, (GridGroupSummaryItem)view.GroupSummary[0])); } else { e.Info.DisplayText = string.Format("Count: {0}", view.GetGroupSummaryValue(e.RowHandle, (GridGroupSummaryItem)view.GroupSummary[0])); } } if (e.Column.FieldName == "Liter") { if (e.RowHandle % 2 == 0) { e.Info.DisplayText = string.Format("Max: {0}", view.GetGroupSummaryValue(e.RowHandle, (GridGroupSummaryItem)view.GroupSummary[1])); } else { e.Info.DisplayText = string.Format("Avr: {0}", view.GetGroupSummaryValue(e.RowHandle, (GridGroupSummaryItem)view.GroupSummary[1])); } } }
private void gridView1_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { GridSummaryItem summary = e.Info.SummaryItem; // Obtain the total summary's value. txtTongTienPhong.EditValue = TongTienGio + Convert.ToDouble(summary.SummaryValue); }
/// <summary> /// 自定义表格尾部数据统计 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridView1_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { int dx = e.Bounds.Height; //Brush brush = e.Cache.GetGradientBrush(e.Bounds, Color.Transparent, Color.Transparent, System.Drawing.Drawing2D.LinearGradientMode.Vertical); Rectangle r = e.Bounds; r.Inflate(1, -1); //r.Inflate(0, -1); Pen p = new Pen(Color.Gray); Brush brush = e.Cache.GetGradientBrush(e.Bounds, Color.WhiteSmoke, Color.WhiteSmoke, System.Drawing.Drawing2D.LinearGradientMode.Vertical); e.Graphics.FillRectangle(brush, r); e.Graphics.DrawRectangle(p, r.X - 1, r.Y, r.Width, r.Height); //e.Graphics.DrawRectangle(p, r.X - 1, r.Y, r.Width+1, r.Height); //ControlPaint.DrawBorder(e.Graphics, r, Color.Gray, ButtonBorderStyle.Solid); //r.Inflate(-1, -1); //e.Graphics.FillRectangle(brush, r); //r.Inflate(-2, 0); e.Appearance.DrawString(e.Cache, e.Info.DisplayText, r); if (firstfootcell) { //e.Graphics.DrawRectangle(p, r.X-1, r.Y, r.Width, r.Height); e.Appearance.DrawString(e.Cache, "总计", r); firstfootcell = false; } e.Handled = true; }
private void gridView1_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { if (e.Info != null) { if (e.Column.FieldName == "TutTL" && (double)e.Info?.Value < 0) { e.Appearance.ForeColor = Color.MediumVioletRed; } } }
private void grdVwEx2_CustomDrawRowFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { //if (e.Column.FieldName == "OK") //{ // LinearGradientBrush backBrush = new LinearGradientBrush(e.Bounds, Color.Orange, Color.PeachPuff, LinearGradientMode.Vertical); // e.Graphics.FillRectangle(backBrush, e.Bounds); // ControlPaint.DrawBorder3D(e.Graphics, e.Bounds, Border3DStyle.SunkenInner); // e.Graphics.DrawString("bbbbbb", e.Appearance.Font, new SolidBrush(Color.Blue), e.Bounds, e.Appearance.GetStringFormat()); // e.Handled = true; //} }
private void grvListado_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { try { if (e.Column == colDetCosto) { //Utilizamos para poder poner el costo a la derecha e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; e.Appearance.Font = new Font(e.Appearance.Font, FontStyle.Bold); e.Appearance.DrawString(e.Cache, e.Info.DisplayText, e.Bounds); e.Handled = true; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gridViewChiTietHoaDonNhap_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { GridView view = sender as GridView; if (e.Column == colTongTien) { string text = e.Info.DisplayText; e.Appearance.Font = new Font("Arial", 14); e.Info.DisplayText = formatCurrentcy(text); e.Info.Bounds = new Rectangle(e.Info.Bounds.Left, e.Info.Bounds.Top, e.Info.Bounds.Width, e.Info.Bounds.Height + 10); } else { e.Handled = true; } }
private void GridView_AttendanceData_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { if (IsInvalidValue(e.Info.Value)) { int dx = e.Bounds.Height; Brush brush = e.Cache.GetGradientBrush(e.Bounds, Color.Wheat, Color.FloralWhite, LinearGradientMode.Vertical); Rectangle r = e.Bounds; //Draw a 3D border BorderPainter painter = BorderHelper.GetPainter(DevExpress.XtraEditors.Controls.BorderStyles.Style3D); AppearanceObject borderAppearance = new AppearanceObject(e.Appearance) { BorderColor = Color.DarkGray }; painter.DrawObject(new BorderObjectInfoArgs(e.Cache, borderAppearance, r)); //Fill the inner region of the cell r.Inflate(-1, -1); e.Cache.FillRectangle(brush, r); //Draw a summary value r.Inflate(-2, 0); e.Appearance.DrawString(e.Cache, e.Info.DisplayText, r); //Prevent default drawing of the cell e.Handled = true; /* * StringFormat format = new StringFormat(); * format.Alignment = StringAlignment.Near; * Rectangle r = e.Bounds; * r.Inflate(-2, 0); * Font f = new System.Drawing.Font("Tahoma", 8.25f, FontStyle.Bold); * * e.Appearance.BackColor = Color.FromArgb(50, 255, 0, 0); * e.Appearance.DrawString(e.Cache, e.Info.DisplayText, r, f, format); */ /* * e.Appearance.BackColor = Color.FromArgb(50, 255, 0, 0); * e.Appearance.FillRectangle(e.Cache, e.Bounds); * e.Info.AllowDrawBackground = false; */ } }
private void gridView1_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { GridView view = sender as GridView; if (e.Column == colCategoryID) { e.Painter.DrawObject(e.Info); Rectangle r = e.Info.Bounds; string text = e.Info.DisplayText; e.Info.Bounds = new Rectangle(e.Info.Bounds.Left, e.Info.Bounds.Bottom + 1, e.Info.Bounds.Width, e.Info.Bounds.Height); e.Info.DisplayText = view.Columns["Dummy"].SummaryText; e.Painter.DrawObject(e.Info); e.Handled = true; e.Info.Bounds = r; e.Info.DisplayText = text; } else if (e.Column == colCategoryName) { e.Handled = true; } }
private void GridView_SalaryProcess_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { if (IsInvalidValue(e.Info.Value)) { int dx = e.Bounds.Height; Brush brush = e.Cache.GetGradientBrush(e.Bounds, Color.Wheat, Color.FloralWhite, LinearGradientMode.Vertical); Rectangle r = e.Bounds; //Draw a 3D border BorderPainter painter = BorderHelper.GetPainter(DevExpress.XtraEditors.Controls.BorderStyles.Style3D); AppearanceObject borderAppearance = new AppearanceObject(e.Appearance) { BorderColor = Color.DarkGray }; painter.DrawObject(new BorderObjectInfoArgs(e.Cache, borderAppearance, r)); //Fill the inner region of the cell r.Inflate(-1, -1); e.Cache.FillRectangle(brush, r); //Draw a summary value r.Inflate(-2, 0); e.Appearance.DrawString(e.Cache, e.Info.DisplayText, r); //Prevent default drawing of the cell e.Handled = true; } }
private void gridViewChiTietHoaDonNhap_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { GridView view = sender as GridView; if (e.Column == colTongTien) { string text = e.Info.DisplayText; if (text.Length > 3 && text.IndexOf(',') > 0) { } else { e.Appearance.Font = new Font("Tahoma", 10F); e.Info.DisplayText = formatCurrentcy(text); e.Info.Bounds = new Rectangle(e.Info.Bounds.Left, e.Info.Bounds.Top, e.Info.Bounds.Width, e.Info.Bounds.Height + 10); this.gridViewChiTietHoaDonNhap.CustomDrawFooterCell -= new DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventHandler(this.gridViewChiTietHoaDonNhap_CustomDrawFooterCell); } } else { e.Handled = true; } }
private void GridView2_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { e.Appearance.BackColor = Color.White; e.Appearance.ForeColor = Color.Red; }
private void afdGridView_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { //e.Appearance.ForeColor = Color.Blue; //Sadece ForeColor calisiyor, BackColor olmuyor //e.Info.DisplayText = string.Format("{0} {1:n2}", afbRow.BDVZ, e.Info.Value); }