惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
V
V2EX
aimingoo的专栏
aimingoo的专栏
爱范儿
爱范儿
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
月光博客
月光博客
云风的 BLOG
云风的 BLOG

博客园 - 禹过天晴

TextControl技术互助 博文阅读密码验证 - 博客园 (转)不通过web.config在运行时注册httpmodules (学)如何在Oracle中一次执行多条sql语句 (学)条件性唯一性索引的建议 阿里云服务器IIS启用HTTPS协议(转) (原)用WebBrowser浏览Office Web Apps Server,除去“下载”按钮 博文阅读密码验证 - 博客园 如何让Oracle表及字段显示为区分大小写(转) (转)SQL Server 列转行 博文阅读密码验证 - 博客园 (转)基于SQL的EAN13、ENA8条形码校验位生成 博文阅读密码验证 - 博客园 (原)将Oracle迁移到SQLServer (转)Sql Server 快速查看表结构(表描述及字段说明) 博文阅读密码验证 - 博客园 (转)SQL查询案例:多行转换为一行 (转)找回vss超级管理员密码 (转)SqlServer里DateTime转字符串
(学)递归查找窗体中全部控件
禹过天晴 · 2018-01-17 · via 博客园 - 禹过天晴
/// <summary>
        /// 通过递归将控件及子级控件信息列为树形
        /// </summary>
        /// <param name="pControl"></param>
        /// <param name="pControlName"></param>
        public void BuildControlTree(dynamic pControl, string pControlName = null)
        {
            try
            {
                string strConName = "";
                if (pControl.Name == "" && pControl.Text == "") return;
                //if (PCon is DevExpress.XtraEditors.SplitGroupPanel)
                //    strConName = PID + PCon.Text;
                //else
                //    strConName = PCon.Name == "" ? PCon.Text : PCon.Name;
                strConName = (pControlName == null ? "" : pControlName + "-") + (pControl.Name == "" ? pControl.Text : pControl.Name);
                DataRow dr = dsControlTree.DT_ControlTree.NewRow();
                dr["ID"] = strConName;
                dr["ParentID"] = pControlName;
                dr["ControlName"] = strConName;
                dr["ControlType"] = pControl.GetType().Name;
                dsControlTree.DT_ControlTree.Rows.Add(dr);
                //DicCon.Add(strConName, PCon);
                //插入其子控件
                if (pControl is GridControl)
                {
                    //循环其gridview
                    foreach (GridView gv in pControl.Views)
                    {
                        BuildControlTree(gv, strConName);
                    }
                }
                else if (pControl is GridView)
                {
                    //循环其gridcolumn
                    foreach (GridColumn gdc in pControl.Columns)
                    {
                        BuildControlTree(gdc, strConName);
                    }
                }
                else if (pControl is LayoutControl)
                {
                    return;
                }
                else if (pControl is TreeList)
                {
                    //循环其TreeListColumn
                    foreach (TreeListColumn tlc in pControl.Columns)
                    {
                        BuildControlTree(tlc, strConName);
                    }
                }
                else
                {
                    if (pControl is Control && pControl.Controls.Count > 0)
                    {
                        foreach (Control CCom in pControl.Controls)
                        {
                            BuildControlTree(CCom, strConName);
                        }
                    }
                }
            }
            catch
            { }
        }