全部列统计: var iSum:Integer; begin with ListView1.Items.Add do begin for i:=0 to ListView1.Columns.Count-1 do begin iSum:=0; for j:=0 to ListView1.Items.Count-1 do begin if i=0 then Inc(iSum,StrToInt(ListView1.Items[j].Caption)) else Inc(iSum,StrToInt(ListView1.Items[j].SubItems[j-1])); end; if i:=0 then Caption:=IntToStr(iSum) else SubItems.Add(IntToStr(iSum)); end; end;end;
var
iSum:Integer;
begin
with ListView1.Items.Add do
begin
for i:=0 to ListView1.Columns.Count-1 do
begin
iSum:=0;
for j:=0 to ListView1.Items.Count-1 do
begin
if i=0 then
Inc(iSum,StrToInt(ListView1.Items[j].Caption))
else
Inc(iSum,StrToInt(ListView1.Items[j].SubItems[j-1]));
end;
if i:=0 then
Caption:=IntToStr(iSum)
else
SubItems.Add(IntToStr(iSum));
end;
end;end;