array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(3) "428" ["text"]=> string(77) "Visual Studio 2017 单独启动MSDN帮助(Microsoft Help Viewer)的方法" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(8) "DonetRen" ["tagsname"]=> string(55) "Visual Studio 2017|MSDN帮助|C#程序|.NET|Help Viewer" ["tagsid"]=> string(23) "[401,402,403,"300",404]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400964" ["_id"]=> string(3) "428" } [1]=> array(10) { ["id"]=> string(3) "427" ["text"]=> string(42) "npm -v;报错 cannot find module "wrapp"" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "zzty" ["tagsname"]=> string(50) "node.js|npm|cannot find module "wrapp“|node" ["tagsid"]=> string(19) "[398,"239",399,400]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400760" ["_id"]=> string(3) "427" } [2]=> array(10) { ["id"]=> string(3) "426" ["text"]=> string(54) "说说css中pt、px、em、rem都扮演了什么角色" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(12) "zhengqiaoyin" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400640" ["_id"]=> string(3) "426" } [3]=> array(10) { ["id"]=> string(3) "425" ["text"]=> string(83) "深入学习JS执行--创建执行上下文(变量对象,作用域链,this)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "Ry-yuan" ["tagsname"]=> string(33) "Javascript|Javascript执行过程" ["tagsid"]=> string(13) "["169","191"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511399901" ["_id"]=> string(3) "425" } [4]=> array(10) { ["id"]=> string(3) "424" ["text"]=> string(30) "C# 排序技术研究与对比" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "vveiliang" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(8) ".Net Dev" ["catesid"]=> string(5) "[199]" ["createtime"]=> string(10) "1511399150" ["_id"]=> string(3) "424" } [5]=> array(10) { ["id"]=> string(3) "423" ["text"]=> string(72) "【算法】小白的算法笔记:快速排序算法的编码和优化" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "penghuwan" ["tagsname"]=> string(6) "算法" ["tagsid"]=> string(7) "["344"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511398109" ["_id"]=> string(3) "423" } [6]=> array(10) { ["id"]=> string(3) "422" ["text"]=> string(64) "JavaScript数据可视化编程学习(二)Flotr2,雷达图" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "chengxs" ["tagsname"]=> string(28) "数据可视化|前端学习" ["tagsid"]=> string(9) "[396,397]" ["catesname"]=> string(18) "前端基本知识" ["catesid"]=> string(5) "[198]" ["createtime"]=> string(10) "1511397800" ["_id"]=> string(3) "422" } [7]=> array(10) { ["id"]=> string(3) "421" ["text"]=> string(36) "C#表达式目录树(Expression)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "wwym" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1511397474" ["_id"]=> string(3) "421" } [8]=> array(10) { ["id"]=> string(3) "420" ["text"]=> string(47) "数据结构 队列_队列实例:事件处理" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "idreamo" ["tagsname"]=> string(40) "C语言|数据结构|队列|事件处理" ["tagsid"]=> string(23) "["246","247","248",395]" ["catesname"]=> string(12) "数据结构" ["catesid"]=> string(7) "["133"]" ["createtime"]=> string(10) "1511397279" ["_id"]=> string(3) "420" } [9]=> array(10) { ["id"]=> string(3) "419" ["text"]=> string(47) "久等了,博客园官方Android客户端发布" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(3) "cmt" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511396549" ["_id"]=> string(3) "419" } } ["count"]=> int(200) } 222 ComboBox与TreeView组合控件 ComboBoxTree(转帖) - 爱码网

平时常用无限级分类,只是这个无限级树,每次都得拖ComboBox,设置,拖TreeView,再设置,代码里也得整来整去,很是麻烦,也很是不爽,所以改造下。

不过我的水平想组合这两个东西,可太有难度了,所以还是上网上找到,在CodeProject上找到一个评价还不错的,拿下来修改,改造了两天,终于可以很方便的使用了。

不过还是我的水平问题,这个控件使用的东西很多理解不了,所以感觉改的不是很好,只能说能很方便的使用。

调用方法:

填充:comboBoxTree1.Fill(DataTable dt, object ParentID)

        ///


        /// 填充Tree
        ///

        /// 父级编号
        /// 格式,三列,Id,Name,ParentId,只要顺序一样就可以了
        public void Fill(DataTable dt, object ParentID)

设置值:SelectedByValue(object value, object text)

        ///


        /// 根据值来查找
        ///

        ///
        /// Text可以随便写,当然,最好是什么就写什么
        public void SelectedByValue(object value, object text)

取值:Text,Value,FullPath

comboBoxTree1.Value
comboBoxTree1.Text
comboBoxTree1.FullPath

主要代码太多,这里只发他的调用方法吧:

view plaincopy to clipboardprint?

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Data.SqlClient;  
  6. using System.Drawing;  
  7. using System.Text;  
  8. using System.Windows.Forms;  
  9. namespace Demo  
  10. {  
  11. public partial class Form1 : Form  
  12.     {  
  13. public Form1()  
  14.         {  
  15.             InitializeComponent();  
  16.         }  
  17. private void Form1_Load(object sender, EventArgs e)  
  18.         {  
  19.             comboBoxTree1.Fill(GetDataTable(), "0");  
  20.         }  
  21. private void btnGet_Click(object sender, EventArgs e)  
  22.         {  
  23.             MessageBox.Show(  
  24. "Value:"+comboBoxTree1.Value+  
  25. "\nText:"+comboBoxTree1.Text+  
  26. "\nFullPath:"+comboBoxTree1.FullPath  
  27.                 );  
  28.         }  
  29. private void btnSet_Click(object sender, EventArgs e)  
  30.         {  
  31. //comboBoxTree1.SelectedByValue(3, "Name333");
  32.             comboBoxTree1.SelectedByValue(3, "Name3");  
  33.         }  
  34. private DataTable GetDataTable()  
  35.         {  
  36. string[,] array3D = {   
  37.                                 { "1", "ComboBoxTree1", "0"},   
  38.                                 { "2", "ComboBoxTree2", "1"},   
  39.                                 { "3", "ComboBoxTree3", "1"},   
  40.                                 { "4", "ComboBoxTree4", "2"},   
  41.                                 { "5", "ComboBoxTree5", "2"},   
  42.                                 { "6", "ComboBoxTree6", "5"},   
  43.                                 };  
  44. return ArrayToDataTable.ArrayToDataTable.Convert(array3D);  
  45.         }  
  46. private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)  
  47.         {  
  48.             System.Diagnostics.Process.Start("Iexplore.exe", "http://www.yongfa365.com/");  
  49.         }  
  50.     }  
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Demo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            comboBoxTree1.Fill(GetDataTable(), "0");
        }

        private void btnGet_Click(object sender, EventArgs e)
        {
            MessageBox.Show(
                "Value:"+comboBoxTree1.Value+
                "\nText:"+comboBoxTree1.Text+
                "\nFullPath:"+comboBoxTree1.FullPath
                
                );
        }

        private void btnSet_Click(object sender, EventArgs e)
        {
            //comboBoxTree1.SelectedByValue(3, "Name333");
            comboBoxTree1.SelectedByValue(3, "Name3");
        }



        private DataTable GetDataTable()
        {

            string[,] array3D = { 
                                { "1", "ComboBoxTree1", "0"}, 
                                { "2", "ComboBoxTree2", "1"}, 
                                { "3", "ComboBoxTree3", "1"}, 
                                { "4", "ComboBoxTree4", "2"}, 
                                { "5", "ComboBoxTree5", "2"}, 
                                { "6", "ComboBoxTree6", "5"}, 
                                };
            return ArrayToDataTable.ArrayToDataTable.Convert(array3D);
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("Iexplore.exe", "http://www.yongfa365.com/");
        }

    }
}

演示文件及相关源码下载地址:ComboBoxTree.rar

主要代码来源与:http://www.codeproject.com/KB/miscctrl/CSDropDownPanel.aspx

相关文章: