Node.Tag
是一个Object类型的

解决方案 »

  1.   

    属性Tag可以传递所有的数据类型
      

  2.   

    呵呵
    来晚了
    tag属性,check MSDN
      

  3.   

    如果楼主决的功能不够强就继承他;
    using System;
    using System.Collections;
    using System.Windows.Forms;
    namespace GMonitor
    {
    public class GroupNode : TreeNode
    {
    private string nodeType;
    private DataSet ds;

    #region 构造函数
    public GroupNode(string text,string nodeType,DataSet ds):base(text)
    {
    this.nodeType = nodeType;
    this.ds= ds;
    }
    public GroupNode(string text,TreeNode[] children,string nodeType,DataSet ds):base(text,children)
    {
    this.nodeType = nodeType;
    this.ds = ds;
    }
    public GroupNode(string text,int imageIndex,int selectedImageIndex,string nodeType,DataSet ds):base(text,imageIndex,selectedImageIndex)
    {
    this.nodeType = nodeType;
    this.ds= ds;
    }
    public GroupNode(string text,int imageIndex,int selectedImageIndex,TreeNode[] children,string nodeType,DataSet ds):base(text,imageIndex,selectedImageIndex,children)
    {
    this.nodeType = nodeType;
    this.ds= ds;
    }
    #endregion /// <summary>
    /// 获取节点属性
    /// </summary>
    public string NodeType
    {
    get{return this.nodeType;}
    }
    /// <summary>
    /// 获取或设置主机信息
    /// </summary>
    public DataSet Ds
    {
    get{return this.ds;}
    set{this.ds= value;}
    } }
    }
    ============================
    使用
    GroupNode gn = (GroupNode)this.TreeView1.SelectedNode;