回复 楼主 lin8812290
这是我编写财务软件的一个实例,你可以参考
procedure TF_PZ.TreeView1DblClick(Sender: TObject);
var
s:string;
node1,node2,node3,node4:TTreenode;
r1:integer;
begin
r1:=stringGrid1.Row;
node1:=TREEView1.Selected;
s:=node1.Text;
if node1.Parent<>nil then
begin
node2:=node1.Parent;
node2.Expanded:=false;
if node2.Parent<>nil then
begin
node3:=node2.Parent;
node3.Expanded:=false;
if node3.Parent<>nil then
begin
node4:=node3.Parent;
node4.Expanded:=false;
end;
end;
end;