Creamos una columna en el DBGrid y no le asignamos ningún campo, en el caption (Title) le ponemos el nombre de "No.", luego en el evento OnDrawColumnCell del DBGrid colocamos éste sencillo código:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if DataSource1.DataSet.RecNo > 0 then begin if Column.Title.Caption = 'No.' then DBGrid1.Canvas.TextOut(Rect.Left + 2, Rect.Top, IntToStr(DataSource1.DataSet.RecNo)); end; end;
Y obtendrán un resultado como éste: