本帖最后由 luojianfeng 于 2011-02-14 18:56:29 编辑

解决方案 »

  1.   

    1、使新加的结点,正处于selected;
    2、在其它窗口:
    var Node : TTreeNode;
    begin
      Node := TreeView1.Selected;
      Node.ImageIndex:=0;    
      Node.StringData:=ID;  
      Node.SelectedIndex:=5;                       
      .....
    end;
      

  2.   

    var Node : TTreeNode;
    begin
    ...
    Node:= FormKcsp.TreeView1.Items.AddChild(FormKcsp.TreeView1.Selected,Edit1.Text);
    Node.Data:=....end;
      

  3.   

    跟父窗体一样,加个变量Node := 。。
      

  4.   


    哦,d7也有的。Allocates space on and copies a string to the heap; returning a pointer to the string.UnitSysUtilsCategorybackward compatibility routinesDelphi syntax:function StrNew(const Str: PChar): PChar;C++ syntax:extern PACKAGE char * __fastcall StrNew(const char * Str);DescriptionStrNew allocates a copy of Str on the heap. If Str is nil (Delphi) or NULL (C++) or points to an empty string, StrNew returns a pointer to a new empty string.Otherwise, StrNew makes a duplicate of Str, obtaining space with a call to StrAlloc, and returns a pointer to the duplicated string. The allocated space is the length of Str + 5 bytes.
    This example uses an edit control and a button on a form. When the button is clicked, memory is allocated for a copy of the text in the edit control, the text is displayed in a message box, and then the memory is deallocated.uses Sysutils;
    procedure TForm1.Button1Click(Sender: TObject);var
      Temp: PChar;
    begin
      // Allocate memory.
      Temp := StrNew(PChar(Edit1.Text));
      ShowMessage(Temp, 'StrNew, StrDispose example', MB_OK);
      // Deallocate memory.
      StrDispose(Temp);
    end;那它与
    ShowMessage(PChar(Edit1.Text), 'StrNew, StrDispose example', MB_OK);
    的差别是什么呢?
    就是多申请、释放一下了空间?
      

  5.   

    var Node : TTreeNode;
     然後處理它的Selected.....