Subject | IB_Grid cells color |
---|---|
Author | manuelfresnedaguerra@yahoo.es |
Post date | 2001-08-09T08:59:06Z |
Hi all,
How can i draw a cell with a color if i has a determinate value,
i try whith OnGetCellColor, but when the cell lost the focus the
color change.
I try with this:
procedure TForm1.IB_Grid1GetCellColor(Sender: TObject; ACol, ARow:
Integer;
AState: TGridDrawState; var AColor: TColor);
begin
with IB_Grid1 do
begin
{Pone la celda en Amarillo si es el precio y es menor que 0}
if ARow = Row then
if ACol = Col then
if (Assigned( GridFields[ DataCol[ACol]])) and
(GridFields[ DataCol[ACol]].FieldName = 'ARTPRE') then
if IB_Query1.FieldByName('artpre').AsFloat < 0 then
AColor := clYellow;
end;
end;
Thanks.
How can i draw a cell with a color if i has a determinate value,
i try whith OnGetCellColor, but when the cell lost the focus the
color change.
I try with this:
procedure TForm1.IB_Grid1GetCellColor(Sender: TObject; ACol, ARow:
Integer;
AState: TGridDrawState; var AColor: TColor);
begin
with IB_Grid1 do
begin
{Pone la celda en Amarillo si es el precio y es menor que 0}
if ARow = Row then
if ACol = Col then
if (Assigned( GridFields[ DataCol[ACol]])) and
(GridFields[ DataCol[ACol]].FieldName = 'ARTPRE') then
if IB_Query1.FieldByName('artpre').AsFloat < 0 then
AColor := clYellow;
end;
end;
Thanks.