增加查找控件内部所有控件的方法

master
lhiven 6 months ago
parent aa788aed7e
commit 4058a492ee

@ -14,6 +14,28 @@ namespace Rs.Framework
{ {
public static class ControlManager public static class ControlManager
{ {
public static List<Control> GetControlList(Control findControl)
{
List<Control> list = GetContolsInternal(findControl, new List<Control>());
return list;
}
private static List<Control> GetContolsInternal(Control findControl,List<Control> foundControls)
{
if(findControl!=null && findControl.Controls.Count>0)
{
foreach (Control subControl in findControl.Controls)
{
foundControls.Add(subControl);
if(subControl.Controls.Count > 0)
{
foundControls= GetContolsInternal(subControl, foundControls);
}
}
}
return foundControls;
}
/// <summary> /// <summary>
/// 通过控件Tag查找控件数组 /// 通过控件Tag查找控件数组
/// </summary> /// </summary>

Loading…
Cancel
Save