Yes, it would be if it is painted, but the first record already comes selected.
when I want to verify I do so
if query.FieldByName(campo_id).AsInteger >= 1 then
// procedimento para realizar chamada de tela entre outros...
CARING!!
DBGDados.Columns.Grid.Focused
Checks if the focus is on the grid!!
If you want to change the color of the selected line you have this code
if not odd(qyrBuscaBanco.RecNo) then // deixa grid zebrado
begin
if not (gdSelected in State) then
begin
dbgrdBanco.Canvas.Brush.Color := clMoneyGreen;
dbgrdBanco.Canvas.FillRect(Rect);
dbgrdBanco.DefaultDrawDataCell(rect,Column.Field,state);
end;
end;
with dbgrdBanco do // pinta a linha selecionada
begin
if DataSource.DataSet.State in [dsEdit, dsInsert, dsBrowse] then
begin
if (Rect.Top = TStringGrid(dbgrdBanco).CellRect( DataCol ,TStringGrid(dbgrdBanco).Row).Top)
or( gdSelected in State) then
begin
Canvas.FillRect(Rect);
Canvas.Brush.Color := [COR PARA A LINHA SELECIONADA];
DefaultDrawDataCell(Rect,Column.Field,State)
end;
end;
end;