在 .Net 框架中 treeView是作为一个外部控件另外提供的. 请问:
1:  哪里有下载 treeView 控件?
2:  如何将 treeView 添加到 .Net框架中.
3:  如何对treeView进行编程, 能提供些示例代码下载地址(C#)吗?在线等.

解决方案 »

  1.   

    http://www.jiabaili.com/Downloads/TreeView.rar
      

  2.   

    using System.Windows.Forms;
    namespace Test
    {
         class HowEasy:Form
        {
                      private System.Windows.Forms.TreeView treeView1;
       
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.Container components = null; public Form1()
    {
    //
    // Required for Windows Form Designer support
    //
    InitializeComponent(); //
    // TODO: Add any constructor code after InitializeComponent call
    //
    } /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    this.treeView1 = new System.Windows.Forms.TreeView();
     
    this.SuspendLayout();
    // 
    // treeView1
    // 
    this.treeView1.ImageIndex = -1;
    this.treeView1.Location = new System.Drawing.Point(8, 8);
    this.treeView1.Name = "treeView1";
    this.treeView1.SelectedImageIndex = -1;
    this.treeView1.Size = new System.Drawing.Size(264, 360);
    this.treeView1.TabIndex = 0;
    //treeView1上添加节点
                               this.treeView1.Cnotrols.AddRange(new TreeNode[]{ new TreeNode("FirstLevel"),new TreeNode("SceondLevel") });   
    //HowEasy
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    this.ClientSize = new System.Drawing.Size(616, 381);
    this.Controls.Add(this.treeView1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.Load += new System.EventHandler(this.Form1_Load);
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
        
    }
        }
    }
      

  3.   

    treeview 重要的是它的TREENODE(包括TREENODE.NODES)还有折叠,展开两个函数,事件有很多自己从MSDN上查查看
      

  4.   

    TreeView控件可以从工具箱右击进行添加
    TreeView空件主要常用的是使用递归算法进行显示如:
      假设有数据源DataTable dt,其中已有数据,结构为ID,PID,Name...
      DataRow dr = GetRootDr(dt);//取得根记录
      TreeView tv = new Treeview();
      TreeNode tnParent = tv.Nodes[0];
      tnParent.Text = dr["Name"].ToString();
      tbParent.Tag  = dr["ID"].ToString();
      tv.Nodes.Add(tnParent);
      DispChild(tnParent,dt)  private void DispChild(TreeNode tnParent,DataTable dt)
      {
           DataRow[] drs = GetChildren(tnParent.Text,dt);//获取下级节点信息
           
           foreach(DataRow dr in drs)
           {
             TreeNode tn = tv.Nodes[0];
             tn.Text = dr["Name"].ToString();
             tn.Tag  = dr["ID"].ToString();
             tnParent.Nodes.Add(tn);
             DispChild(tnParent,dt)        }
       }
      

  5.   

    信箱?
    可以传给你控件和一些代码。
    [email protected]