const
TRIGGER_COLUMN = 5;
TRIGGER_UNDER = 0;
TRIGGER_LOW = 100;
TRIGGER_MID = 500;
TRIGGER_TEXTUNDER = clWhite;
TRIGGER_BACKUNDER = clRed;
TRIGGER_TEXTLOW = clWhite;
TRIGGER_BACKLOW = clMaroon;
TRIGGER_TEXTMID = clBlack;
TRIGGER_BACKMID = clMoneyGreen;
TRIGGER_TEXTHIGH = clBlack;
TRIGGER_BACKHIGH = clTeal;
procedure TPrepaidList.PrepaidGridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
if (ARow > 0) then
with Sender as TStringGrid do
begin
if StrToIntDef(Cells[TRIGGER_COLUMN,ARow],999) >= TRIGGER_MID then
ColorCell( Canvas, Rect, Cells[ACol,ARow], TRIGGER_TEXTHIGH, TRIGGER_BACKHIGH );
if StrToIntDef(Cells[TRIGGER_COLUMN,ARow],999) >= TRIGGER_LOW then
if StrToIntDef(Cells[TRIGGER_COLUMN,ARow],999) < TRIGGER_MID then
ColorCell( Canvas, Rect, Cells[ACol,ARow], TRIGGER_TEXTMID, TRIGGER_BACKMID );
if StrToIntDef(Cells[TRIGGER_COLUMN,ARow],999) >= TRIGGER_UNDER then
if StrToIntDef(Cells[TRIGGER_COLUMN,ARow],999) < TRIGGER_LOW then
ColorCell( Canvas, Rect, Cells[ACol,ARow], TRIGGER_TEXTLOW, TRIGGER_BACKLOW );
if StrToIntDef(Cells[TRIGGER_COLUMN,ARow],999) < TRIGGER_UNDER then
ColorCell( Canvas, Rect, Cells[ACol,ARow], TRIGGER_TEXTUNDER, TRIGGER_BACKUNDER );
end;
end;