int GetStatusValue(PivotCustomDrawCellEventArgs e) { int revenue = Convert.ToInt32(e.GetCellValue(fieldRevenue)), goal = Convert.ToInt32(e.GetCellValue(fieldGoal)); return(Comparer.Default.Compare(revenue, goal)); }
private void pivotGridControl1_CustomDrawCell(object sender, 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, PivotCustomDrawCellEventArgs e) { if (e.DataField != fieldStatus && e.DataField != fieldTrend) { return; } Bitmap bitmap = null; if (e.DataField == fieldStatus) { bitmap = pivotGridControl1.GetKPIBitmap(statusGraphic, GetStatusValue(e)); } else { bitmap = pivotGridControl1.GetKPIBitmap(trendGraphic, GetTrendValue(e)); } e.Graphics.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds); if (e.DataField != fieldTrend || e.RowValueType != PivotGridValueType.GrandTotal) { e.Graphics.DrawImage(bitmap, e.Bounds.Left + (e.Bounds.Width - bitmap.Width) / 2, e.Bounds.Top + (e.Bounds.Height - bitmap.Height) / 2); } e.Handled = true; }
private void pvgSICCleaned_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e) { if (_foundClean == true) { e.Appearance.BackColor = Color.White; try { if (pvgSICCleaned.Cells.GetCellInfo(e.ColumnIndex, e.RowIndex).GetFieldValue(colc_WP).ToString() != null) { TheSelectedDate = pvgSICCleaned.Cells.GetCellInfo(e.ColumnIndex, e.RowIndex).GetFieldValue(colc_CalendarDate).ToString(); DataRow[] EditedRow = dtSICClean.Select("CalendarDate = '" + TheSelectedDate + "' "); foreach (DataRow dr in EditedRow) { TheEditWorkingDay = dr["ShiftNo"].ToString(); } if (TheEditWorkingDay == "N") { e.Appearance.BackColor = Color.Red; } if (pvgSICCleaned.Cells.GetCellInfo(e.ColumnIndex, e.RowIndex).GetFieldValue(colc_Type).ToString() == "Book FL") { if (TheEditWorkingDay != "N") { e.Appearance.BackColor = Color.Gainsboro; } } } } catch (Exception _exception) { throw new ApplicationException(_exception.Message, _exception); } } }
void PivotGridControlOnCustomDrawCell(object sender, PivotCustomDrawCellEventArgs e) { var point = new Point(e.ColumnIndex, e.RowIndex); var events = _ruleCollector.DrawCellRules(point).Select(DrawCell); foreach (var cellEvent in events) { cellEvent.Calculate(e); } }
int GetTrendValue(PivotCustomDrawCellEventArgs e) { if (e.RowIndex == 0) { return(0); } object prevYearRevenue = e.GetPrevRowCellValue(fieldRevenue), thisYearRevenue = e.GetCellValue(fieldRevenue); return(Comparer.Default.Compare(thisYearRevenue, prevYearRevenue)); }
private void onCustomDrawCell(PivotCustomDrawCellEventArgs e) { if (e.DataField != ValueField) { return; } if (e.Value == null) { updateAppearanceBackColor(e.Appearance, Colors.Disabled); } }
private void pivotGridControl1_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e) { int index = 0; PivotGridField[] fields = e.GetRowFields(); for (int i = 0; i < fields.Length; i++) { if (fields[i].Caption == BalanceTableViewData.CATEGORY) { index = i; break; } } if (index >= 0 && fields.Length > index) { if (e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_IN_BALANCE) || e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_OUT_BALANCE) ) { e.Appearance.BackColor = Color.PowderBlue; e.Appearance.BackColor2 = Color.PowderBlue; e.Appearance.Options.UseBackColor = true; } else if (e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_IN_TARGET) || e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_OUT_TARGET) ) { e.Appearance.BackColor = Color.WhiteSmoke; e.Appearance.BackColor2 = Color.WhiteSmoke; e.Appearance.Options.UseBackColor = true; } else if (e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_IN_PLAN) || e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_OUT_PLAN) ) { e.Appearance.BackColor = Color.WhiteSmoke; e.Appearance.BackColor2 = Color.WhiteSmoke; e.Appearance.Options.UseBackColor = true; } } index = 0; // 색상 변경 : 특정 Data Cell : 색상 처리 if (e.DataField.FieldName == BalanceTableViewData.QTY && (decimal)e.GetFieldValue(e.DataField) < 0) { e.Appearance.Options.UseBackColor = true; e.Appearance.DrawBackground(e.GraphicsCache, e.Bounds); e.Appearance.DrawString(e.GraphicsCache, e.DisplayText, e.Bounds, e.Appearance.Font, Brushes.Red, e.Appearance.GetStringFormat()); e.Handled = true; } }
public void Calculate(PivotCustomDrawCellEventArgs e) { decimal value = Convert.ToDecimal(e.Value); if (value > 0) { e.Appearance.ForeColor = Color.Green; } else if (value < 0) { e.Appearance.ForeColor = Color.Red; } }
private void pivotGridControl1_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e) { // 색상 변경 : 특정 Data Cell : 색상 처리 if ((e.DataField.FieldName == JobChangePlanData.QTY) && e.Value != null && (decimal)e.GetFieldValue(e.DataField) > 0) { e.Appearance.Options.UseBackColor = true; e.Appearance.DrawBackground(e.GraphicsCache, e.Bounds); e.Appearance.BackColor = Color.Yellow; e.Appearance.BackColor2 = Color.Yellow; e.Appearance.DrawString(e.GraphicsCache, e.DisplayText, e.Bounds, e.Appearance.Font, Brushes.Black, e.Appearance.GetStringFormat()); e.Handled = true; } }
private void pivotGridControl1_CustomDrawCell(object sender, 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, PivotCustomDrawCellEventArgs e) { Rectangle r; if (e.RowValueType == PivotGridValueType.GrandTotal) { r = Rectangle.Inflate(e.Bounds, -3, -3); e.GraphicsCache.FillRectangle(new LinearGradientBrush(e.Bounds, Color.Blue, 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) { r = Rectangle.Inflate(e.Bounds, -3, -3); e.GraphicsCache.FillRectangle(new LinearGradientBrush(e.Bounds, Color.FromArgb(0x00, 0xCC, 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.Selected) { r = Rectangle.Inflate(e.Bounds, -3, -3); e.GraphicsCache.DrawString(e.DisplayText, e.Appearance.Font, new SolidBrush(Color.FromArgb(0x33, 0x66, 0xFF)), r, e.Appearance.GetStringFormat()); e.Handled = true; } else if (e.DataField == percents) { r = Rectangle.Inflate(e.Bounds, -3, -3); e.GraphicsCache.DrawString(e.DisplayText, e.Appearance.Font, new SolidBrush(Color.FromArgb(0x00, 0xCC, 0xFF)), r, e.Appearance.GetStringFormat()); e.Handled = true; } else if (e.DataField == percents2) { r = Rectangle.Inflate(e.Bounds, -3, -3); e.GraphicsCache.DrawString(e.DisplayText, e.Appearance.Font, new SolidBrush(Color.FromArgb(0x99, 0xCC, 0xFF)), r, e.Appearance.GetStringFormat()); e.Handled = true; } }
private void pivotGridControl1_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e) { int index = 0; PivotGridField[] fields = e.GetRowFields(); for (int i = 0; i < fields.Length; i++) { if (fields[i].Caption == TargetPlanCompareData.CATEGORY) { index = i; break; } } if (e.Value != null && (decimal)e.GetFieldValue(e.DataField) < 0) { e.Appearance.Options.UseBackColor = true; //e.Appearance.BackColor = Color.Yellow; //e.Appearance.BackColor2 = Color.Yellow; e.Appearance.ForeColor = Color.Red; } index = 0; for (int i = 0; i < fields.Length; i++) { if (fields[i].Caption == "FACTORY") { index = i; break; } } if (index >= 0 && fields.Length > index && e.GetFieldValue(fields[index]).ToString().StartsWith(TargetPlanCompareData.TOTAL)) { e.Appearance.BackColor = Color.LightGreen; e.Appearance.BackColor2 = Color.LightGreen; e.Appearance.Options.UseBackColor = true; } //if (index >= 0 && fields.Length > index && e.GetFieldValue(fields[index]).ToString().StartsWith("Plan")) //{ // e.Appearance.BackColor = Color.Gainsboro; // e.Appearance.BackColor2 = Color.Gainsboro; // e.Appearance.Options.UseBackColor = true; //} }
void PivotGridControlOnCustomDrawCell(object sender, PivotCustomDrawCellEventArgs e) { var fieldPeriod = PivotGridListEditor.PivotGridControl.Fields[Model.NetIncome.ColumnFieldName]; if (Equals(e.GetFieldValue(fieldPeriod), CurrentPeriod)) { var fieldMonth = PivotGridListEditor.PivotGridControl.Fields[Model.NetIncome.RowFieldName]; object month = e.GetFieldValue(fieldMonth); var fieldRevenue = PivotGridListEditor.PivotGridControl.Fields[Model.NetIncome.DataFieldName]; decimal currentValue = Convert.ToDecimal(e.GetCellValue(fieldRevenue)), compareValue = Convert.ToDecimal(e.GetCellValue(new object[] { ComparePeriod }, month != null ? new[] { e.GetFieldValue(fieldMonth) } : null, fieldRevenue)); if (currentValue > compareValue) { e.Appearance.ForeColor = CommonColors.GetInformationColor(UserLookAndFeel.Default); } else if (currentValue < compareValue) { e.Appearance.ForeColor = CommonColors.GetCriticalColor(UserLookAndFeel.Default); } } }
private void pgWorkplaceList_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e) { if (e.DataField == fieldDepartmentApproved) { if (Convert.ToInt32(e.Value) == -1) { e.Graphics.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds); e.Graphics.DrawImage(imageCollection1.Images[0], e.Bounds.Left + (e.Bounds.Width - imageCollection1.Images[0].Width) / 2, e.Bounds.Top + (e.Bounds.Height - imageCollection1.Images[0].Height) / 2); } if (Convert.ToInt32(e.Value) == 1) { e.Graphics.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds); e.Graphics.DrawImage(imageCollection1.Images[1], e.Bounds.Left + (e.Bounds.Width - imageCollection1.Images[1].Width) / 2, e.Bounds.Top + (e.Bounds.Height - imageCollection1.Images[1].Height) / 2); } if (Convert.ToInt32(e.Value) == 0) { e.Graphics.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds); e.Graphics.DrawImage(imageCollection1.Images[2], e.Bounds.Left + (e.Bounds.Width - imageCollection1.Images[2].Width) / 2, e.Bounds.Top + (e.Bounds.Height - imageCollection1.Images[2].Height) / 2); } if (Convert.ToInt32(e.Value) == 2) { e.Graphics.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds); e.Graphics.DrawImage(imageCollection1.Images[3], e.Bounds.Left + (e.Bounds.Width - imageCollection1.Images[3].Width) / 2, e.Bounds.Top + (e.Bounds.Height - imageCollection1.Images[3].Height) / 2); } e.Handled = true; } }