Z
zpselect
Unregistered / Unconfirmed
GUEST, unregistred user!
各位高手property的定义和使用我很不理解,可否给一些简单通俗的实例?并加以解释说明!我现在对这个东东的定义使用糢糊不清!另外我对递归这个东东也不熟悉,望各位指点一下!我现在给出递归原码:
procedure AddTreeView(ReportTree: TTreeView; const Path: string; ParentNode: TTreeNode);
var
FindHandle: Integer;
Node: TTreeNode;
SearchRec: TSearchRec;//system Function
begin
FindHandle := FindFirst(Path + '*.*', faAnyFile, SearchRec); //在指定的位置查找第一个文件
while FindHandle = 0 do
begin
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
if (SearchRec.Attr and faDirectory) > 0 then
begin
Node := ReportTree.Items.AddChild(ParentNode, SearchRec.Name);//在该父结点下加一个节点
with Node do //对该结点进行相关操作
begin
Text := SearchRec.Name;
AddTreeView(ReportTree, Path + SearchRec.Name + '/', Node);
end;// 请问这一句 AddTreeView递归是什么意思?
end
else
ReportTree.Items.AddChild(ParentNode, ExtractFileNameString(SearchRec.Name));
FindHandle := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
另外:if (SearchRec.Attr and faDirectory) > 0 then语句中Attr:integer,faDirectory = $00000010;请问这个判断怎么理解?
procedure AddTreeView(ReportTree: TTreeView; const Path: string; ParentNode: TTreeNode);
var
FindHandle: Integer;
Node: TTreeNode;
SearchRec: TSearchRec;//system Function
begin
FindHandle := FindFirst(Path + '*.*', faAnyFile, SearchRec); //在指定的位置查找第一个文件
while FindHandle = 0 do
begin
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
if (SearchRec.Attr and faDirectory) > 0 then
begin
Node := ReportTree.Items.AddChild(ParentNode, SearchRec.Name);//在该父结点下加一个节点
with Node do //对该结点进行相关操作
begin
Text := SearchRec.Name;
AddTreeView(ReportTree, Path + SearchRec.Name + '/', Node);
end;// 请问这一句 AddTreeView递归是什么意思?
end
else
ReportTree.Items.AddChild(ParentNode, ExtractFileNameString(SearchRec.Name));
FindHandle := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
另外:if (SearchRec.Attr and faDirectory) > 0 then语句中Attr:integer,faDirectory = $00000010;请问这个判断怎么理解?