如何遍历WinForm中自定义控件内的组件
主要是想遍历WinForm中自定义控件内的组件 如:text combox 等遍历出来后想得到该组件并更改该组件的一些属性 谢谢 --------------------编程问答--------------------
foreach(Control control in userControl.Controls)--------------------编程问答--------------------
{
....
}
foreach(Control ctrl in this.Controls)
{
if(ctrl is YourCustomControl)
{
(ctrl as YourCustomControl).Text = "修改属性值";
}
}
// 1) 以上遍历当前窗体容器的直接子控件
// 2) 如果窗体有GroupBox等容器控件,则要递归遍历其子控件
补充:.NET技术 , .NET Framework