如何取得TreeView的第一级Item?

Caobiao 2005-04-04 06:05:08
TreeView内容如下:
a
+-+a1
|
+a2
|
+a3
b
+-+b1
|
+b2
|
+b3
c
+- ...
d
+- ...
现在我想取得TreeView下的a,b,c,d(只要这几个),怎么取?谢谢!
...全文
90 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
gzmhero 2005-04-04
  • 打赏
  • 举报
回复
for i := 0 to TreeView1.Items.Count - 1 do
begin
if TreeView1.Items[i].Level=0 then

..........//////TreeView.Items[i]就是想要的记录。
end;
Caobiao 2005-04-04
  • 打赏
  • 举报
回复
谢谢!
亮剑_ 2005-04-04
  • 打赏
  • 举报
回复
To: shove(shove)
您打错了:),0 应为 i

for i := 0 to TreeView1.Items.Count-1 do
begin
if TreeView1.Items[i].Level <> 0 then continue;
... //需要的 Item
end;
亮剑_ 2005-04-04
  • 打赏
  • 举报
回复
for i := 0 to TreeView1.Items.Count - 1 do
begin
if TreeView1.Items[i].Parent <> nil then continue;
... //需要的 Item
end;
qiujsh 2005-04-04
  • 打赏
  • 举报
回复
取node.level=0的记录
shove 2005-04-04
  • 打赏
  • 举报
回复
for i := 0 to TreeView1.Items.Count-1 do
begin
if TreeView1.Items[0].Level <> 0 then continue;
... //需要的 Item
end;

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧