zoukankan      html  css  js  c++  java
  • Delphi中treeview的使用部分

         

    procedure TForm1.Button1Click(Sender: TObject);

    var
      MyTreeNode1, MyTreeNode2: TTreeNode;
    begin
      with TreeView1.Items do
      begin
        Clear; { remove any existing nodes }
        MyTreeNode1 := Add(nil, 'RootTreeNode1'); { Add a root node }
        { Add a child node to the node just added }
        AddChild(MyTreeNode1,'ChildNode1');

        {Add another root node}
        MyTreeNode2 := Add(MyTreeNode1, 'RootTreeNode2');
        {Give MyTreeNode2 to a child }
        AddChild(MyTreeNode2,'ChildNode2');

        {Change MyTreeNode2 to ChildNode2 }
        { and add a child node to it}
        MyTreeNode2 := TreeView1.Items[3];
        AddChild(MyTreeNode2,'ChildNode2a');

        {Add another child to ChildNode2, after ChildNode2a }
        Add(MyTreeNode2,'ChildNode2b');

        {add another root node}
        Add(MyTreeNode1, 'RootTreeNode3');
      end;

    end;

  • 相关阅读:
    构造器
    方法
    Arrays常用的类
    栈内存和堆内存
    方法的重载
    数组遍历
    Scanner类
    连接符和三元运算符
    逻辑运算和位运算
    CSAPP笔记(第二章 信息的表示和处理)-02
  • 原文地址:https://www.cnblogs.com/feng801/p/1273437.html
Copyright © 2011-2022 走看看