• DevExpress组件之——TreeList组件


     由于是第一次接触到第三方控件DevExpress中的TreeList,对其进行了进一步的研究,采用递归算法实现。做下自己熟悉第三方控件的整个过程,为和我一样处理于起步阶段的同仁们提供个参考,以下为最终效果

    1、以下是代码实现

    代码
    
    Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 //加载行政区数据
    public void LoadDistrictData()
    {
        string distsql = "select * from district";
        DataTable dataTable = _dbhelp.GetDataTable(distsql);
        this.tvDist.Nodes.Clear();
        TreeListNode treenode = tvDist.AppendNode(new object[] { "广西壮族自治区" }, null);
        treenode.Tag = 1000;
        treenode.Expanded = false;
        CreateChildNodes(treenode, dataTable);
        tvDist.Nodes[0].Expanded = true;
    }
    
    private void CreateChildNodes(DevExpress.XtraTreeList.Nodes.TreeListNode node, DataTable dataTable)
    {
        DataRow[] rowList = dataTable.Select("SUPERID = '" + node.Tag + "'");
        foreach (DataRow row in rowList)
        {
            TreeListNode tempNode = this.tvDist.AppendNode(new object[] { row["NAME"] }, node);
            tempNode.Tag = row["ID"];
            CreateChildNodes(tempNode, dataTable);
        }
    }
  • 相关阅读:
    poj 3621(最优比率环)
    bzoj 1497(最大权闭合子图)
    Dinic(模板 再错是不可能的 这辈子都不可能了)
    BZOJ 2038
    zoj 3822(概率dp)
    poj 3683(2-sat+拓扑排序)
    poj 2186(tarjan+缩点)
    hdu 5782(kmp+hash)
    hdu 6035(树形dp)
    Python爬取房屋租售信息
  • 原文地址:https://www.cnblogs.com/jara/p/3363594.html
Copyright © 2020-2023  润新知