procedure TForm1.Button1Click(Sender: TObject); var sl:TStringList; begin sl:=TStringList.Create; sl.Add('23424');//filesize sl.Add('c:\windows\system');//filePath listView1.Items.Item[0].SubItems:=sl; sl.Free;end;
var i, j: Integer; begin for i := 0 to ListView1.Items.Count - 1 do begin ListView1.Items.Item[i].Caption := IntToStr(i); for j := 0 to ListView1.Items.Item[i].SubItems.Count - 1 do ListView1.Items.Item[i].SubItems[j] := IntToStr(j); // 子项 end;
动态添加:procedure TForm1.Button1Click(Sender: TObject); var sl:TStringList; li:TListItem; begin li:=listview1.Items.Add; li.Caption:='filename.ext'; sl:=TStringList.Create; sl.Add('23424');//filesize sl.Add('c:\windows\system');//filePath li.SubItems:=sl; sl.Free;end;
var
sl:TStringList;
begin
sl:=TStringList.Create;
sl.Add('23424');//filesize
sl.Add('c:\windows\system');//filePath
listView1.Items.Item[0].SubItems:=sl;
sl.Free;end;
i, j: Integer;
begin
for i := 0 to ListView1.Items.Count - 1 do begin
ListView1.Items.Item[i].Caption := IntToStr(i);
for j := 0 to ListView1.Items.Item[i].SubItems.Count - 1 do
ListView1.Items.Item[i].SubItems[j] := IntToStr(j); // 子项
end;
var
sl:TStringList;
li:TListItem;
begin
li:=listview1.Items.Add;
li.Caption:='filename.ext';
sl:=TStringList.Create;
sl.Add('23424');//filesize
sl.Add('c:\windows\system');//filePath
li.SubItems:=sl;
sl.Free;end;
揭帖,揭帖。
现在是在修改时,Listview闪啊~~~~~闪的我眼睛花~