/// <summary>
/// 将容器的Contro属性下控件的转换成枚举类型以便使用LINQ语句进行查询
/// </summary>
/// <param name="container"></param>
/// <returns></returns>
public IEnumerable<Control> GetControls(Control container)
{
foreach (Control childControl in container.Controls)
{
// Recurse child controls.
foreach (var grandChild in GetControls(childControl))
yield return grandChild;
yield return childControl;
}
}
C# 将控件的Controls属性下的所有控件取出以便使用LINQ语句进行查询
最新推荐文章于 2024-06-21 08:34:23 发布