1stClass的TDBtreeview一问:关于节点的图标(100分)

  • 主题发起人 千中元
  • 开始时间

千中元

Unregistered / Unconfirmed
GUEST, unregistred user!
主细结构:
query1:select * from employee
query2:select * from orders
where empNo=:empNo
displayfields:
"FirstName" "LastName"
"SaleDate"
现在树上需要三个图标:
当该组未展开的时候,图标1----所有的组都是一个图标(图标1)
当该组展开的时候,图标2---该展开的组名前为图标2
该组展开以后,该组下的项目(SaleDate),用图标3。
我试了几天都不行,用的是
procedure TForm1.fcDBTreeView1CalcNodeAttributes(
TreeView: TfcDBCustomTreeView; Node: TfcDBTreeNode);
begin
if node.DataSet=query1 then
if Node.Hot then
Node.StateIndex:=1
else node.StateIndex:=0;
if Node.DataSet=Query2 then
Node.StateIndex:=3;
end;
看来这样写是错了,现在只是能在组别前显示图标1,而期待得图标2,图标3
永远也不出来:(
除了这100分以外(供努力了但未成功,如同我一样的,获得),
另外悬赏300分,有效期20天。
 
记住先,有时间再研究。
 
现在已经解决了2/3,所以悬赏剩下100分了,呵呵
现在的问题成了给二级node指定图标的问题。
procedure TForm1.fcDBTreeView1CalcNodeAttributes(
TreeView: TfcDBCustomTreeView; Node: TfcDBTreeNode);
begin
if (Node.HasChildren) and (Node.Expanded) then
Node.StateIndex:=1
else
if (Node.HasChildren) and (not node.Expanded) then
node.StateIndex:=0
else
Node.StateIndex:=3;---这本是想给二级node指定的图标,可惜不作用也
end;
 
你试试看那个level属性的操作!

反正你只需要把二级节点图表改变
 
这样写不是清楚很多?
if (Node.HasChildren) then
begin
if (Node.Expanded) then
Node.StateIndex:=1
else
node.StateIndex:=0
end
else //到底什么是第二级?try
begin //I have no fc now, so I give u only idea
//Node.StateIndex:=3;---这本是想给二级node指定的图标,可惜不作用也
if Node.Parent <> nil then
if (Node.Parent as TFCTreeNode).Expanded then
Node.StateIndex:=3;
end;
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
顶部