46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
using System;
|
|
using CPF.Drawing;
|
|
using CPF.ReoGrid.Rendering;
|
|
|
|
namespace CPF.ReoGrid.CellTypes
|
|
{
|
|
[Serializable]
|
|
public class ProgressCell : CellBody
|
|
{
|
|
public Color TopColor { get; set; }
|
|
|
|
public Color BottomColor { get; set; }
|
|
|
|
public ProgressCell()
|
|
{
|
|
this.TopColor = Color.LightSkyBlue;
|
|
this.BottomColor = Color.SkyBlue;
|
|
}
|
|
|
|
public override void OnPaint(CellDrawingContext dc)
|
|
{
|
|
double data = base.Cell.GetData<double>();
|
|
bool flag = data > 0.0;
|
|
if (flag)
|
|
{
|
|
DrawingContext platformGraphics = dc.Graphics.PlatformGraphics;
|
|
float left = base.Bounds.Left;
|
|
float num = base.Bounds.Top + 1f;
|
|
float num2 = (float)((double)base.Bounds.Width * data);
|
|
float num3 = base.Bounds.Height - 1f;
|
|
Rect rect = new Rect(ref left, ref num, ref num2, ref num3);
|
|
bool flag2 = rect.Width > 0f && rect.Height > 0f;
|
|
if (flag2)
|
|
{
|
|
dc.Graphics.FillRectangleLinear(this.TopColor, this.BottomColor, 90f, rect);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override ICellBody Clone()
|
|
{
|
|
return new ProgressCell();
|
|
}
|
|
}
|
|
}
|