例:TreeView1.Items.AddChildObject(TreeView1.Selected,'New Item',MyBitMap);
3 个解决方案
#1
Ptr是指针。他可以是对象
#2
是指向你加的新节点的值的指针,例如加菜单项内容为节点内容,可以
var
vTreeNode: TTreeNode;
i:inteegr;
for I := 0 to Pred(mMenuItem.Count) do
if mMenuItem[I].Visible then begin
vTreeNode := mTreeView.Items.AddChildObject(mTreeNode,
StripHotkey(mMenuItem[I].Caption), mMenuItem[I]);
var
vTreeNode: TTreeNode;
i:inteegr;
for I := 0 to Pred(mMenuItem.Count) do
if mMenuItem[I].Visible then begin
vTreeNode := mTreeView.Items.AddChildObject(mTreeNode,
StripHotkey(mMenuItem[I].Caption), mMenuItem[I]);
#3
下面的2个方法是一样的
var
Tmpnode :TTreeNode ;
begin
Tmpnode := TreeView1.Items.AddChildObject(TreeView1.Selected,'New Item',MyBitMap);
end
var
Tmpnode :TTreeNode ;
begin
Tmpnode := TreeView1.Items.AddChild(TreeView1.Selected,'New Item');
Tmpnode.data := MyBitMap;
end
var
Tmpnode :TTreeNode ;
begin
Tmpnode := TreeView1.Items.AddChildObject(TreeView1.Selected,'New Item',MyBitMap);
end
var
Tmpnode :TTreeNode ;
begin
Tmpnode := TreeView1.Items.AddChild(TreeView1.Selected,'New Item');
Tmpnode.data := MyBitMap;
end
#1
Ptr是指针。他可以是对象
#2
是指向你加的新节点的值的指针,例如加菜单项内容为节点内容,可以
var
vTreeNode: TTreeNode;
i:inteegr;
for I := 0 to Pred(mMenuItem.Count) do
if mMenuItem[I].Visible then begin
vTreeNode := mTreeView.Items.AddChildObject(mTreeNode,
StripHotkey(mMenuItem[I].Caption), mMenuItem[I]);
var
vTreeNode: TTreeNode;
i:inteegr;
for I := 0 to Pred(mMenuItem.Count) do
if mMenuItem[I].Visible then begin
vTreeNode := mTreeView.Items.AddChildObject(mTreeNode,
StripHotkey(mMenuItem[I].Caption), mMenuItem[I]);
#3
下面的2个方法是一样的
var
Tmpnode :TTreeNode ;
begin
Tmpnode := TreeView1.Items.AddChildObject(TreeView1.Selected,'New Item',MyBitMap);
end
var
Tmpnode :TTreeNode ;
begin
Tmpnode := TreeView1.Items.AddChild(TreeView1.Selected,'New Item');
Tmpnode.data := MyBitMap;
end
var
Tmpnode :TTreeNode ;
begin
Tmpnode := TreeView1.Items.AddChildObject(TreeView1.Selected,'New Item',MyBitMap);
end
var
Tmpnode :TTreeNode ;
begin
Tmpnode := TreeView1.Items.AddChild(TreeView1.Selected,'New Item');
Tmpnode.data := MyBitMap;
end