1 下载 treeGridView.DLL库文件。
2 添加到工程中。

右键“工具箱”选择“选择项” 弹出对话框

选择“浏览” 选中下载还的dll库文件。完成后工具箱中会有 treeGridView控件,如下图

拖动控件到windform 中

添加代码

 List<personcl> lst = new List<personcl>();
//personcl per = new personcl { name = "cese", age = 1 };
personcl per1 = new personcl { name = "cese", age = 2 };
//lst.Add(per);
lst.Add(per1);
personcl per2 = new personcl { name = "cese", age = 3 };
per1.subitem.Add(per2);
personcl per3 = new personcl { name = "cese", age = 4 };
per2.subitem.Add(per3);
//lst.Add(new personcl { name = "wyl", age = 10, subitem = new List<personcl> { new personcl { name = "wyl", age = 11 } } }); SetNodes(lst, treeGridView1.Nodes);
public class personcl
{
public string name = "1";
public int age = 10; public List<personcl> subitem = new List<personcl>();
}

  

private void SetNodes(IEnumerable<personcl> lst, TreeGridNodeCollection nodes)
{ foreach (var item in lst)
{
var node = nodes.Add(item.name, item.age);
node.ImageIndex = 0;
SetNodes(item.subitem, node.Nodes);
}
}

  

参考: https://www.cnblogs.com/mrtiny/p/5174095.html

C# windform 使用TreeGridView的更多相关文章

  1. C# TreeGridView 实现进程列表

    效果如图 0x01 获取进程列表,使用Win32Api规避"拒绝访问"异常 public List<AppProcess> GetAppProcesses() { In ...

  2. c# winform treelistview的使用(treegridview)

    TreeView控件显示的内容比较单一,如果需要呈现更详细信息TreeListView是一个不错的选择. 先看效果: 首先需要引用文件System.Windows.Forms.TreeListView ...

  3. windform 重绘Treeview "+-"号图标

    模仿wind系统界面,重绘Treeview + - 号图标 一,首先需要图片 ,用于替换原有的 +-号 二.新建Tree扩展类 TreeViewEx继承TreeView using System; u ...

  4. C# windform自定义控件的属性小知识

    word中的加粗变斜之类的一直让我以为是button,直到我接触了自定义控件,才发现实现这种机能最好的是CheckBox,然后我们在做一个系统的时候,这种控件有可能要用好多次,总不能在用一次的时候,就 ...

  5. Entity Framework4.0 (一)概述(EF4 的Database First方法)

    转自:http://www.cnblogs.com/marksun/archive/2011/12/15/2289582.html Entity Framework4.0(以后简称:EF4),是Mic ...

  6. vs在winform中不给力哈-错误不提示

    我的操作系统是windows Server 2008 x64,运行winform的时候,对Dictionary累加值.运行的时候,项目一闪而过,于是我在Project的Properties上选择运行的 ...

  7. Ionic app 上传图片之webApi接口

    App上传图片对应的webApi服务端是怎么处理的呢? using System; using System.Collections.Generic; using System.Diagnostics ...

  8. 在Winform中菜单动态添加“最近使用文件”

    最近在做文件处理系统中,要把最近打开文件显示出来,方便用户使用.网上资料有说,去遍历“C:\Documents and Settings\Administrator\Recent”下的最近文档本.文主 ...

  9. 通过源码了解ASP.NET MVC 几种Filter的执行过程 在Winform中菜单动态添加“最近使用文件”

    通过源码了解ASP.NET MVC 几种Filter的执行过程   一.前言 之前也阅读过MVC的源码,并了解过各个模块的运行原理和执行过程,但都没有形成文章(所以也忘得特别快),总感觉分析源码是大神 ...

随机推荐

  1. [ES]elasticsearch章2 ES查询过程解析

    es服务端是准确知道每个document分布在哪个shard上: search一个比较复杂的执行模式,因为我们不知道那些document会被匹配到,任何一个shard上都有可能,所以一个search请 ...

  2. [ ZooKeeper]ZooKeeper 的功能和原理

    Zookeeper功能简介: ZooKeeper 是一个开源的分布式协调服务,由雅虎创建,是 Google Chubby 的开源实现.分布式应用程序可以基于 ZooKeeper 实现诸如数据发布/订阅 ...

  3. inet_pton和inet_ntop inet_ntoa

    Linux下地址转换函数 inet_pton ==> Ox inet_ntop ==> xxx.xxx.xxx #include <sys/types.h> #include ...

  4. set集合的排序

    在hibernate的OneToMany的实体关联的时候,one端的set是无序的,可是需要按照顺序来搞的话就比较麻烦了. 下面给出一个例子. Set<DiaryPicture> diar ...

  5. Educational Codeforces Round 61 C 枚举 + 差分前缀和

    https://codeforces.com/contest/1132/problem/C 枚举 + 差分前缀和 题意 有一段[1,n]的线段,有q个区间,选择其中q-2个区间,使得覆盖线段上的点最多 ...

  6. Ubuntu下删除卸载程序图标

    Ubuntu下删除卸载程序图标 方法一:直接在终端输入命令alacarte.可以任意增.改.隐藏.显示菜单,但无法删除菜单,即使拥有root权限. 方法二:注意几个目录和文件./usr/share/a ...

  7. PYTHON编码处理-str与Unicode的区别

    一篇关于STR和UNICODE的好文章 整理下python编码相关的内容 注意: 以下讨论为Python2.x版本, Py3k的待尝试 开始 用python处理中文时,读取文件或消息,http参数等等 ...

  8. IntelliJ IDEA 2017版 使用笔记(五) 模板 live template自定义设置(二) ;postfix使用;IDE快捷键使用

    一.live template 活模板     就像这个单词的含义一样,live template就是一个高效的提高代码,书写速度的方式,(live template位置File-----settin ...

  9. python科学计算模块NumPy

    NumPy是Numerical Python的简称,是高性能科学计算和数据分析的基础包.其实NumPy 本身并并没有提供太多的高级的数据分析功能, 但是理解NumPy数组以及面向数组的计算将有利于你更 ...

  10. RestTemplate将响应数据转换为具有泛型的类对象

    前言: 重要,RestTemplate在SpringBoot项目里即便通过HttpMessageConverters添加了Fastjson且优先级比jackson要高也不会在RestTemplate里 ...