Paint DBGrid lines when selecting them

6

I'm painting the lines of a

asked by anonymous 07.04.2014 / 15:03

1 answer

5

Do as follows:

procedure TFrmCadLicenca.dbgTerminaisDrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  inherited;
  if cdsTerminal.IsEmpty then exit;

  if cdsTerminalAcess_TerE.AsString <> 'S' then
  begin
    if (gdSelected in State) and dbgTerminais.Focused then
    begin
      dbgTerminais.Canvas.Brush.Color := clRed;
      dbgTerminais.Canvas.Font.Color := clWhite;
      dbgTerminais.DefaultDrawDataCell(Rect, Column.Field, State);
    end
    else
    begin
      dbgTerminais.Canvas.Brush.Color := clMaroon;
      dbgTerminais.Canvas.Font.Color := clWhite;
      dbgTerminais.DefaultDrawDataCell(Rect, Column.Field, State);
    end;
  end;
end;

I would advise testing with and additional, dbgTerminais.Focused .

    
07.04.2014 / 15:56