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

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 热门话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
C
Cisco Blogs
A
Arctic Wolf
月光博客
月光博客
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
量子位
小众软件
小众软件
Latest news
Latest news
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
N
Netflix TechBlog - Medium
K
Kaspersky official blog
人人都是产品经理
人人都是产品经理
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
Y
Y Combinator Blog
P
Proofpoint News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
S
Schneier on Security
D
Docker
Scott Helme
Scott Helme
MyScale Blog
MyScale Blog
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
GbyAI
GbyAI
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
H
Help Net Security
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tenable Blog
B
Blog
Know Your Adversary
Know Your Adversary
IT之家
IT之家

博客园 - Louis.Lu.Sz

在C#中,如果声明字段时不加关键字volatile,会影响多线程环境中对该字段的访问吗? Win10, Win11 Ping不通 FastReport使用笔记 Windows窗体控件库的小秘密 在windows桌面显示IP等信息的小工具分享 oracle,根据查询结果结构创建新表 Oracle多表关联如何更新多个字段 我想实现一个通用的配置读写类 【转】Android程序右上角不显示3个点的菜单 Visual studio项目调试时提示“ 你正在调试XXXX的发布版本。” 【原】记录一下第一次使用Python简单处理Excel 【原创】分享一种WPF列表数据的分页打印方案 [原创] 分享一种Asp.NetMVC WebApi作为后端技术结合Vue前端框架开发时开发环境的优雅配置方案 [转]Errors while building APK. You can find the errors in the 'Messages' view.解决办法 [转]oracle数据库转mysql数据库 SaveFileDialog下载模板文件 算法:把一个数字拆分成指定数字的和,允许数字个数为0和重复 WPF简单实现可以左右滑动的CheckBox复选框,样式模仿的微信 WPF里借助附加属性让DataGrid显示行号
[原] c# winform controls 查找指定类型子控件的扩展方法
Louis.Lu.Sz · 2020-08-12 · via 博客园 - Louis.Lu.Sz
//调用
this.Controls.Find<Button>(true).ForEach((btn) => { btn.Enabled = false; });


//定义
public static class FormControlExtensions
    {
        /// <summary>
        /// 获得指定类型的孩子控件
        /// </summary>
        /// <typeparam name="TChild">子控件类型</typeparam>
        /// <param name="controlCollection"></param>
        /// <param name="searchAllChildren">如果搜索所有子控件,则为 true;否则为 false。默认为false。</param>
        /// <returns></returns>
        public static List<TChild> Find<TChild>(this Control.ControlCollection controlCollection, bool searchAllChildren = false) 
            where TChild : Control
        {
            var children = new List<TChild>();
            _Find(controlCollection, ref children, searchAllChildren);
            return children;
        }

        /// <summary>
        /// 查询指定类型的子控件(支持递归)
        /// </summary>
        /// <typeparam name="TChild">子控件类型</typeparam>
        /// <param name="controlCollection"></param>
        /// <param name="children"></param>
        /// <param name="searchAllChildren">如果搜索所有子控件,则为 true;否则为 false。默认为false。</param>
        private static void _Find<TChild>(Control.ControlCollection controlCollection, ref List<TChild> children, bool searchAllChildren = false) 
            where TChild : Control
        {
            foreach (Control control in controlCollection)
            {
                if (control is TChild)
                {
                    children.Add((TChild)control);
                }

                if (control.Controls.Count > 0 && searchAllChildren)
                {
                    _Find(control.Controls, ref children, searchAllChildren);
                }
            }
        }
    }