宇
宇宙神
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.DirectoryListBox1Change(Sender: TObject);
var
newitem:tlistitem;
str,strpath:string;
srec:tsearchrec;
falg:integer;
begin
listview1.Items.Clear;
str:=FilterComboBox1.Text;
str:=(copy(str,pos('(',str)+1,pos(')',str)-pos('(',str)-1));
if length(directorylistbox1.Directory)<=3 then
strpath:= directorylistbox1.Directory+str
else
strpath:=directorylistbox1.Directory+'/'+str;
falg:=findfirst(strpath,faanyfile,srec);
if falg=0 then
begin
newitem:=listview1.Items.Add;
newitem.Caption:=srec.Name ;
newitem.SubItems.Add(inttostr(srec.Size ));
//newitem.SubItems.Add(datetimetostr(filedatetodatetime(srec.Size)));//这句话不行
if srec.Attr= 16 then newitem.ImageIndex:=1 ;
while(findnext(srec)=0) do
begin
newitem:=listview1.Items.Add;
newitem.Caption:=srec.Name ;
newitem.SubItems.Add(inttostr(srec.Size ));
// newitem.SubItems.Add(datetimetostr(filedatetodatetime(srec.Size))) ;//这句话不行
if srec.Attr= 16 then newitem.ImageIndex:=1 ;
end;
end;
listview1.AlphaSort;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
DirectoryListBox1change(nil);
end;
还有一个问题是:
listview:=tlistview.Create(self) 和 listview:=tlistview.Create(nil)
有什么不同?
listview.Parent:=self; 表示的是什么,有什么用?
谢谢各位老大!
var
newitem:tlistitem;
str,strpath:string;
srec:tsearchrec;
falg:integer;
begin
listview1.Items.Clear;
str:=FilterComboBox1.Text;
str:=(copy(str,pos('(',str)+1,pos(')',str)-pos('(',str)-1));
if length(directorylistbox1.Directory)<=3 then
strpath:= directorylistbox1.Directory+str
else
strpath:=directorylistbox1.Directory+'/'+str;
falg:=findfirst(strpath,faanyfile,srec);
if falg=0 then
begin
newitem:=listview1.Items.Add;
newitem.Caption:=srec.Name ;
newitem.SubItems.Add(inttostr(srec.Size ));
//newitem.SubItems.Add(datetimetostr(filedatetodatetime(srec.Size)));//这句话不行
if srec.Attr= 16 then newitem.ImageIndex:=1 ;
while(findnext(srec)=0) do
begin
newitem:=listview1.Items.Add;
newitem.Caption:=srec.Name ;
newitem.SubItems.Add(inttostr(srec.Size ));
// newitem.SubItems.Add(datetimetostr(filedatetodatetime(srec.Size))) ;//这句话不行
if srec.Attr= 16 then newitem.ImageIndex:=1 ;
end;
end;
listview1.AlphaSort;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
DirectoryListBox1change(nil);
end;
还有一个问题是:
listview:=tlistview.Create(self) 和 listview:=tlistview.Create(nil)
有什么不同?
listview.Parent:=self; 表示的是什么,有什么用?
谢谢各位老大!