OnDrawColumnCell中 写如下代码实现自动编号,为什么用(2)可以,用(1)不可以呢?
if  column.FieldName='id'  then                 (1)
 // if  column.Index=1 then                        (2)
   begin
           with  DBGrid1.Canvas  do
           begin
                   fillrect(rect);
                   textout(rect.Left  +  2,  rect.Top  +  2,inttostr(DataSet.RecNo));
                   brush.Color  :=  clred;
           end;
   end;