AdvString可以在表格尾部显示一个表尾行,设置代码如下:
- {***************************************************************************}
- { TAdvStringGrid demo application }
- { for Delphi & C++Builder }
- { }
- { written by TMS Software }
- { copyright ?1996-2002 }
- { Email : info@tmssoftware.com }
- { Web : http://www.tmssoftware.com }
- { }
- {***************************************************************************}
- unit Uasg49;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- Dialogs, Grids, BaseGrid, AdvGrid, StdCtrls;
- type
- TForm1 = class(TForm)
- AdvStringGrid1: TAdvStringGrid;
- Button1: TButton;
- Label1: TLabel;
- procedure FormCreate(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure AdvStringGrid1AutoInsertRow(Sender: TObject; ARow: Integer);
- procedure AdvStringGrid1AutoDeleteRow(Sender: TObject; ARow: Integer);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- AdvStringGrid1.FloatingFooter.Visible := True;//设置表脚行可视为真
- AdvStringGrid1.FloatingFooter.ColumnCalc[0] := acCount;//第一列统计为计数
- AdvStringGrid1.FloatingFooter.ColumnCalc[1] := acSum; //第二列统计为求和
- AdvStringGrid1.FloatingFooter.ColumnCalc[2] := acAvg; //第三列统计为平均
- AdvStringGrid1.FloatingFooter.ColumnCalc[3] := acMin; //第四列统计为取最小值
- AdvStringGrid1.FloatingFooter.ColumnCalc[4] := acMax; //第五列统计为取最大值
- AdvStringGrid1.RandomFill(False,100);//添加表格随机数
- AdvstringGrid1.AutoNumberCol(1); //在第1列设置为序号列
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- AdvStringGrid1.RandomFill(false,100)
- end;
- procedure TForm1.AdvStringGrid1AutoInsertRow(Sender: TObject;
- ARow: Integer);
- begin
- AdvstringGrid1.AutoNumberCol(0);//第0列设置为序号列
- end;
- procedure TForm1.AdvStringGrid1AutoDeleteRow(Sender: TObject;
- ARow: Integer);
- begin
- AdvstringGrid1.AutoNumberCol(0);
- end;
- end.
以上设置之后,Advstringgrid控件可以实现表脚行的统计显示。