动态加载树----treeView
来源:互联网 发布:运动视频分析软件 编辑:程序博客网 时间:2024/05/16 05:38
动态加载树----treeView
动态加载树
陈根发
命题:从数据库读取字段值作为树的节点
实现:
一.把字段值取出放到DataSet 中
二.添加一个根节点
三.添加相应的子节点
代码如下
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication3
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TreeView treeView1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.treeView1 = new System.Windows.Forms.TreeView();
this.SuspendLayout();
//
// treeView1
//
this.treeView1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.treeView1.ImageIndex = -1;
this.treeView1.Location = new System.Drawing.Point(0, 137);
this.treeView1.Name = "treeView1";
this.treeView1.SelectedImageIndex = -1;
this.treeView1.Size = new System.Drawing.Size(352, 136);
this.treeView1.TabIndex = 0;
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(352, 273);
this.Controls.Add(this.treeView1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
}
- 动态加载树----treeView
- 动态加载树TreeView
- 动态加载树----treeView
- 动态加载树----treeView
- 动态加载树----treeView
- treeview动态加载树节点
- TreeView动态加载SQL数据创建树
- 动态加载dtree.js树treeview
- XML动态加载TreeView
- 动态加载TreeView
- 动态加载TreeNode -- ComponentArt TreeView
- silverlight TreeView控件 动态加载
- asp.net动态加载dtree.js树treeview
- Ajax动态加载目录树(jquery-treeview)
- Treeview 异步加载树
- 动态加载TreeView时让TreeView节点前显示加号
- VB.NET中动态加载Treeview节点
- VB.NET中动态加载Treeview节点
- ASP可逆算法
- 【nagios】运维神器
- 点击文本框时弹出单选(或复选)对话框,选择选项后在文本框中显示
- #行为科学统计#形状+集中趋势+变异性=简单描述分布
- 建立自己的资源管理器
- 动态加载树----treeView
- 在DataGrid中使用下拉列表框和设置焦点
- 文件删除函数
- datalist我的示例
- 关于打印,实验的结果
- INSERT语法使用技巧一例
- 利用Visual Basic把ASP编写成DLL
- 蓝桥杯——说好的进阶之和式分解
- 聚焦科技新能源关注环保天更蓝