TreeView 在每个NODE上传递一个隐含值啊 Node.Tag是一个Object类型的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 属性Tag可以传递所有的数据类型 呵呵来晚了tag属性,check MSDN 如果楼主决的功能不够强就继承他;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; 纯属个人兴趣的问题 怎样获得鼠标坐标是否在listview控件选中行的矩形坐标内.求大神相助!!! 求正则 导入word模版的问题(在线等,立刻结贴) AfxWnd42类应该是什么BasePattern 类?? 关于接口的迷惑... System.Windows.Shapes.Rectangle与System.Drawing.Rectangle的区别 树视图图象显示 如何终止时钟方法?超简单的问题 怎么知道winform 的DataGrid中用户浏览到哪一行了? 招聘软件开发兼职人员 高手帮忙啊
来晚了
tag属性,check MSDN
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;