码迷,mamicode.com
首页 > Windows程序 > 详细

C# winForm 遍历容器控件内所有Label,修改其背景色

时间:2018-04-20 16:17:04      阅读:338      评论:0      收藏:0      [点我收藏+]

标签:c#   str   遍历   win   tostring   control   controls   span   inf   

            //容器控件为tableLayoutPanel1
       foreach (Control label in tableLayoutPanel1.Controls)
            {
                if (label.GetType().ToString() == "System.Windows.Forms.Label")
                {
                    label.BackColor = Color.Red;
                }
            }

 

C# winForm 遍历容器控件内所有Label,修改其背景色

标签:c#   str   遍历   win   tostring   control   controls   span   inf   

原文地址:https://www.cnblogs.com/nb08611033/p/8890960.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!