treeview的用法 如何建立动态树? 谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var Action: TAction; Category: String; CatList: TStrings; CatIndex: Integer; I: Integer; Node: TTreeNode; ParentNode: TTreeNode; GroupIndex: Integer; GroupExpanded: Integer; SeparatorIndex: Integer;begin tvActions.Images.Assign(Actions.Images); GroupIndex := tvActions.Images.Count; GroupExpanded := GroupIndex + 1; SeparatorIndex := GroupExpanded + 1; FExpandedIndex := GroupExpanded; FCollapsedIndex := GroupIndex; tvActions.Images.AddImages(imgsAdded); CatList := TStringList.Create; try for I := 1 to Actions.ActionCount - 1 do begin try Action := TAction(Actions.Actions[I]); Category := Action.Category; CatIndex := CatList.IndexOf(Category); if CatIndex < 0 then begin ParentNode := tvActions.Items.AddChild(nil, Category); ParentNode.ImageIndex := GroupIndex; ParentNode.SelectedIndex := GroupIndex; Node := tvActions.Items.AddChild(ParentNode, '分隔符'); Node.ImageIndex := SeparatorIndex; Node.SelectedIndex := SeparatorIndex; CatIndex := CatList.AddObject(Category, ParentNode); end; ParentNode := TTreeNode(CatList.Objects[CatIndex]); Node := tvActions.Items.AddChild(ParentNode, Action.Caption); Node.ImageIndex := Action.ImageIndex; Node.SelectedIndex := Action.ImageIndex; Node.Data := Action; except end; end; finally CatList.Free; end;end; 求一个简单实用DELPHI程序打包工具,用了一个打包工具出现下面问题 MessageDlg的问题 TreeView控件中如何设置动态加入结点的图标??? 头痛! 头痛! 进来看看我的机子不知道为什么就不能装winxp,win2000了只能装win98,why???? 急,急!!在线等!! 请问如何获取本机的计算机名 一个新手送分的问题 难道没人知道啊????请教各位了 什么错误,简单问题 请问:哪里可以找到以下的一些控件? 小第有一个关于扑克游戏制作的问题? 使用GetMessage()但不想等待消息到来?
Action: TAction;
Category: String;
CatList: TStrings;
CatIndex: Integer;
I: Integer;
Node: TTreeNode;
ParentNode: TTreeNode;
GroupIndex: Integer;
GroupExpanded: Integer;
SeparatorIndex: Integer;
begin
tvActions.Images.Assign(Actions.Images);
GroupIndex := tvActions.Images.Count;
GroupExpanded := GroupIndex + 1;
SeparatorIndex := GroupExpanded + 1;
FExpandedIndex := GroupExpanded;
FCollapsedIndex := GroupIndex;
tvActions.Images.AddImages(imgsAdded);
CatList := TStringList.Create;
try
for I := 1 to Actions.ActionCount - 1 do
begin
try
Action := TAction(Actions.Actions[I]);
Category := Action.Category;
CatIndex := CatList.IndexOf(Category);
if CatIndex < 0 then
begin
ParentNode := tvActions.Items.AddChild(nil, Category);
ParentNode.ImageIndex := GroupIndex;
ParentNode.SelectedIndex := GroupIndex;
Node := tvActions.Items.AddChild(ParentNode, '分隔符');
Node.ImageIndex := SeparatorIndex;
Node.SelectedIndex := SeparatorIndex;
CatIndex := CatList.AddObject(Category, ParentNode);
end;
ParentNode := TTreeNode(CatList.Objects[CatIndex]);
Node := tvActions.Items.AddChild(ParentNode, Action.Caption);
Node.ImageIndex := Action.ImageIndex;
Node.SelectedIndex := Action.ImageIndex;
Node.Data := Action;
except
end;
end;
finally
CatList.Free;
end;end;