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

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

 

posted @ 2018-04-20 15:01  履霜.1989  阅读(1460)  评论(0编辑  收藏  举报