Estou tentando usar uma condição para colorir somente algumas linhas em um StringGrid. Abaixo o código:
procedure TFrmPrincipal.StrgMovDrawCell(Sender: TObject; aCol, aRow: Integer;
aRect: TRect; aState: TGridDrawState);
var
i : integer;
begin
i := 1;
with StrgMov do
begin
if Time - StrToTime(StrgMov.Cells[3, i]) > StrToTime('00:15:00') then //verifica se o tempo é maior que 15 minutos.
if StrgMov.Cells[4, i] = 'E' then //verifica o tipo de cliente
begin
Canvas.Brush.Color := clRed;
Canvas.FillRect(aRect);
Inc(i);
end;
end;
StrgMov.canvas.textrect(arect, 0, 0, StrgMov.cells[acol,arow]);
end;
Ele fica todo em vermelho e desmontado. a imagem está anexada.
Obrigado.