怎样在dbgrid最左边加一列,显示序号! 如标题!序号就是1,2,3,4根据记录数自动加1。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你就在数据表内加上一 个+Autoicerement类型的字段,他会在记录增加后自动加1,然后在DBGrid里显示其在最左面就行了。 新增一个caculated字段id,integer;在oncaculate事件中with query1 dofiledbyname('id').asinteger:=recno然后将id显示在grid最左边 No.1:添加一个计算字段id然后再table的onCalcFields事件里加table.fieldbyname('id').asinteger:=table1.recno+1就可以了No.2:procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);begin if Column.Index = 5 then with DBGrid1.Canvas do begin FillRect(Rect); TextOut(Rect.Left+2, Rect.Top+2, IntToStr(DBGrid1.DataSource.DataSet.RecNo)); end;end; 最好是用 yesxwl() 的方法 如何在comobox中选择时间?? 这个功能,我实在是不知道用什么方法来实现!已经找了半个月了,无果,你要是有空的话,就进来指点一二! 我不懂这个问题(stringgrid) 关于直接打印的问题? 关于Quickrep问题! 求助~~~~怎么动态让treeview延伸出子项? 做TREEVIEW的快捷方式,大家有没有听说过,出个注意!!! 天大的美事------------100大方 送出,行动吧各位仁兄。 动态二维数组如何声明? 下载的Delphi程序为什么有许多不能运行?如何解决? 如何判断表中某个字段的数据类型?在线等 急!!!简单的录音程序!
在oncaculate事件中
with query1 do
filedbyname('id').asinteger:=recno
然后将id显示在grid最左边
添加一个计算字段id然后再table的onCalcFields事件里加
table.fieldbyname('id').asinteger:=table1.recno+1
就可以了No.2:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Column.Index = 5 then
with DBGrid1.Canvas do begin
FillRect(Rect);
TextOut(Rect.Left+2, Rect.Top+2, IntToStr(DBGrid1.DataSource.DataSet.RecNo));
end;
end;
yesxwl() 的方法