怎样在dbgril中增加一列。 想在dbgril中增加一个计数列,怎么办(数据库,和列属性怎么改),急!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);beginwith DBGrid1.DataSource.DataSet dobegin if DataCol = 0 then//第一列 DBGrid1.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, IntToStr(RecNo));end; 双机使用的Table或 Query 在出现的对话框里添加一个计算字段 procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);begin if column.FieldName='No' then begin Dbgrid1.Canvas.Pen.Color:=clblack; Dbgrid1.Canvas.TextOut(rect.left,rect.top,inttostr (DBGrid1.DataSource.DataSet.RecNo)); end; end; 只要数据库添加或删除记录~~DBGrid就会相应的增加或删除一行~~DBGrid只不过是将数据库的记录以表格的形式显示出来~~所以对想DBGrid进行操作就必须对数据库进行操作~~ 看一下这个,我没法结贴,有人进我就结http://community.csdn.net/Expert/topic/3329/3329927.xml?temp=.3667719 如何在console程序中显现timer的功能。 中国象棋(如何检测出棋面上走了一步棋后,一方将是否正在被对方的炮将军) FlatButton怎么能加入其它格式的图片!!! 关于ADO连接PARDOX数据库的问题? delphi打包用哪个菜单和其中的哪个命令 怎样才能在TabControl上添加页? 怎样判断日期字段为空?(ADO/ACCESS) 如何动态指定access的路径 Listview上加载Panel之后,Listview的垂直滚动条消失? 那里能找到Delphi的好资料 菜鸟问题:字符串的左截对右截对函数是啥? 送分了!!!!!!
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
with DBGrid1.DataSource.DataSet do
begin
if DataCol = 0 then//第一列
DBGrid1.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, IntToStr(RecNo));
end;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if column.FieldName='No' then
begin
Dbgrid1.Canvas.Pen.Color:=clblack;
Dbgrid1.Canvas.TextOut(rect.left,rect.top,inttostr (DBGrid1.DataSource.DataSet.RecNo));
end;
end;
DBGrid就会相应的增加或删除一行~~DBGrid只不过是将数据库的记录以表格的形式显示出来~~
所以对想DBGrid进行操作就必须对数据库进行操作~~
http://community.csdn.net/Expert/topic/3329/3329927.xml?temp=.3667719