using System; using CPF.Drawing; using CPF.ReoGrid.Graphics; using CPF.ReoGrid.Rendering; namespace CPF.ReoGrid.CellTypes { [Serializable] public class NegativeProgressCell : CellBody { public Color PositiveColor { get; set; } public Color NegativeColor { get; set; } public bool LinearGradient { get; set; } public bool DisplayCellText { get; set; } public bool LimitedInsideCell { get; set; } public NegativeProgressCell() { this.PositiveColor = Color.LightGreen; this.NegativeColor = Color.LightCoral; this.LinearGradient = true; this.DisplayCellText = true; this.LimitedInsideCell = true; } public override void OnPaint(CellDrawingContext dc) { double num = base.Cell.GetData(); bool limitedInsideCell = this.LimitedInsideCell; if (limitedInsideCell) { bool flag = num > 1.0; if (flag) { num = 1.0; } else { bool flag2 = num < -1.0; if (flag2) { num = -1.0; } } } IGraphics graphics = dc.Graphics; bool flag3 = num >= 0.0; if (flag3) { float num2 = base.Bounds.Left + base.Bounds.Width / 2f; float num3 = base.Bounds.Top + 1f; float num4 = (float)((double)base.Bounds.Width * (num / 2.0)); float num5 = base.Bounds.Height - 1f; Rect rect = new Rect(ref num2, ref num3, ref num4, ref num5); bool flag4 = rect.Width > 0f && rect.Height > 0f; if (flag4) { bool linearGradient = this.LinearGradient; if (linearGradient) { graphics.FillRectangleLinear(this.PositiveColor, Color.FromColor(0, this.PositiveColor), 0f, rect); } else { graphics.FillRectangle(rect, this.PositiveColor); } } } else { float num6 = this.Bounds.Left + this.Bounds.Width / 2f; float num7 = (float)((double)this.Bounds.Width * num * 0.5); float num2 = num6 + num7; float num3 = base.Bounds.Top + 1f; float num4 = -num7; float num5 = base.Bounds.Height - 1f; Rect rect = new Rect(ref num2, ref num3, ref num4, ref num5); bool flag5 = rect.Width > 0f && rect.Height > 0f; if (flag5) { bool linearGradient2 = this.LinearGradient; if (linearGradient2) { graphics.FillRectangleLinear(this.NegativeColor, Color.FromColor(0, this.NegativeColor), 180f, rect); } else { graphics.FillRectangle(rect, this.NegativeColor); } } } bool displayCellText = this.DisplayCellText; if (displayCellText) { dc.DrawCellText(); } } } }