private void pvgSICCapture_CustomDrawCell(object sender, DevExpress.XtraPivotGrid.PivotCustomDrawCellEventArgs e) { if (_foundSIC == true) { e.Appearance.BackColor = Color.White; try { if (pvgSICCapture.Cells.GetCellInfo(e.ColumnIndex, e.RowIndex).GetFieldValue(col_Description).ToString() != null) { TheSelectedDate = pvgSICCapture.Cells.GetCellInfo(e.ColumnIndex, e.RowIndex).GetFieldValue(col_CalendarDate).ToString(); DataRow[] EditedRow = dtSIC.Select("CalendarDate = '" + TheSelectedDate + "' "); foreach (DataRow dr in EditedRow) { TheEditWorkingDay = dr["ShiftNo"].ToString(); } if (TheEditWorkingDay == "N") { e.Appearance.BackColor = Color.Red; } } } catch (Exception _exception) { throw new ApplicationException(_exception.Message, _exception); } } }
private void pivotGridControl1_CustomDrawCell(object sender, DevExpress.XtraPivotGrid.PivotCustomDrawCellEventArgs e) { int xl = FindLeftMostEqualCell(e); int xr = FindRightMostEqualCell(e, ((PivotGridControl)sender).Cells.ColumnCount); if (xl == e.ColumnIndex && xr > e.ColumnIndex) { int width = e.Bounds.Width; int left = e.Bounds.Left - width * (e.ColumnIndex - xl); int right = e.Bounds.Right + width * (xr - e.ColumnIndex) - 1; Rectangle rec = new Rectangle(left, e.Bounds.Top, right - left, e.Bounds.Height - 1); e.Graphics.FillRectangle(e.Appearance.GetBackBrush(e.GraphicsCache), rec); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; e.Graphics.DrawString(e.DisplayText, e.Appearance.Font, e.Appearance.GetForeBrush(e.GraphicsCache), rec, sf); e.Handled = true; } if (xl < e.ColumnIndex) { e.Handled = true; } }
private void pivotGridControl1_CustomDrawCell(object sender, DevExpress.XtraPivotGrid.PivotCustomDrawCellEventArgs e) { //Rectangle r; //if (e.RowValueType == PivotGridValueType.GrandTotal) //{ // e.GraphicsCache.FillRectangle(new LinearGradientBrush(e.Bounds, Color.LightBlue, // Color.FromArgb(0x00, 0x66, 0xFF), LinearGradientMode.Vertical), e.Bounds); // r = Rectangle.Inflate(e.Bounds, -3, -3); // e.GraphicsCache.FillRectangle(new LinearGradientBrush(e.Bounds, Color.FromArgb(0x00, 0x66, 0xFF), // Color.LightSkyBlue, LinearGradientMode.Vertical), r); // e.GraphicsCache.DrawString(e.DisplayText, e.Appearance.Font, // new SolidBrush(Color.White), r, e.Appearance.GetStringFormat()); // e.Handled = true; // return; //} //if (e.RowValueType == PivotGridValueType.Total) //{ // e.GraphicsCache.FillRectangle(new LinearGradientBrush(e.Bounds, Color.LightBlue, // Color.FromArgb(0x33, 0x66, 0xFF), LinearGradientMode.Vertical), e.Bounds); // r = Rectangle.Inflate(e.Bounds, -3, -3); // e.GraphicsCache.FillRectangle(new LinearGradientBrush(e.Bounds, Color.FromArgb(0x33, 0x66, 0xFF), // Color.LightSkyBlue, LinearGradientMode.Vertical), r); // e.GraphicsCache.DrawString(e.DisplayText, e.Appearance.Font, // new SolidBrush(Color.White), r, e.Appearance.GetStringFormat()); // e.Handled = true; // return; //} }
private void pivotGridControl1_CustomDrawCell(object sender, DevExpress.XtraPivotGrid.PivotCustomDrawCellEventArgs e) { Rectangle r; //Brush backBrush; r = e.Bounds; if (e.Value != null && Convert.ToSingle(e.Value) == 0) { r = Rectangle.Inflate(e.Bounds, -3, -3); e.GraphicsCache.DrawString(e.DisplayText, e.Appearance.Font, new SolidBrush(Color.White), r, e.Appearance.GetStringFormat()); e.Handled = true; } }
private void pivotGridControl1_CustomDrawCell(object sender, DevExpress.XtraPivotGrid.PivotCustomDrawCellEventArgs e) { if (e.DataField == fieldData) { PivotDrillDownDataSource ds = e.CreateDrillDownDataSource(); int hiddenValue = (int)ds.GetValue(0, "hidden"); if (hiddenValue > 0) { e.Appearance.BackColor = Color.Green; } if (hiddenValue < 0) { e.Appearance.BackColor = Color.Red; } } }
private int FindLeftMostEqualCell(DevExpress.XtraPivotGrid.PivotCustomDrawCellEventArgs e) { int x = e.ColumnIndex; for (int i = e.ColumnIndex - 1; i >= 0; i--) { if (e.GetCellValue(e.ColumnIndex, e.RowIndex).Equals(e.GetCellValue(i, e.RowIndex))) { x = i; } else { return(x); } } return(x); }
private int FindRightMostEqualCell(DevExpress.XtraPivotGrid.PivotCustomDrawCellEventArgs e, int columnCount) { int x = e.ColumnIndex; for (int i = e.ColumnIndex + 1; i < columnCount; i++) { if (e.GetCellValue(e.ColumnIndex, e.RowIndex).Equals(e.GetCellValue(i, e.RowIndex))) { x = i; } else { return(x); } } return(x); }
private void pivotGridControl1_CustomDrawCell(object sender, DevExpress.XtraPivotGrid.PivotCustomDrawCellEventArgs e) { }