增加下一級目錄(內容): var ParentNode, TipNode : TTreeNode; //先建立TREEVIEW使用 的子對象 VersionNum : Integer; begin TvwTips.SetFocus; //將焦點置到這個TREEVIEW控件上 VersionNum := TMenuItem( Sender ).Tag; { Ver num of new tip } ParentNode := TvwTips.Selected; { 取出當前的選中節點 } if ParentNode.Level = nlTip then{ Parent cannot be a tip node } ParentNode := TvwTips.Selected.Parent;
TipNode := TvwTips.Items.AddChildObject( ParentNode,'New Subject',Pointer( VersionNum ) ); TipNode.ImageIndex := 3; { Normal tip bitmap } TipNode.SelectedIndex := 4; { Highlighted tip bitmap } TipNode.MakeVisible; { Move new tip node into vIEw } TipNode.EditText; { Immediately allow user to edit subject } EnableTreeVIEwFunctions( TipNode.Level ); RtfTip.Clear; RtfTip.ModifIEd := False; end;