请教在listview中统计有关问题?
请问在listview中统计问题??
不会在listview中最有一行写上 合计: 等信息??
怎么写??
大虾帮忙!!
------解决方案--------------------
全部列统计:
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;
不会在listview中最有一行写上 合计: 等信息??
怎么写??
大虾帮忙!!
------解决方案--------------------
全部列统计:
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;