diff --git a/Rs.Framework/ControlManager.cs b/Rs.Framework/ControlManager.cs
index 17671da..19abec1 100644
--- a/Rs.Framework/ControlManager.cs
+++ b/Rs.Framework/ControlManager.cs
@@ -1,5 +1,6 @@
using Newtonsoft.Json.Linq;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@@ -7,11 +8,70 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
+using static System.Windows.Forms.Form;
namespace Rs.Framework
{
public static class ControlManager
{
+ ///
+ /// 通过控件Tag查找控件数组
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Control[] FindByTag(Control findControl,string tagName, bool searchAllChildren)
+ {
+ if (string.IsNullOrEmpty(tagName))
+ {
+ return null;
+ }
+ ArrayList arrayList = FindInternal(tagName, searchAllChildren,findControl.Controls, new ArrayList());
+ Control[] array = new Control[arrayList.Count];
+ arrayList.CopyTo(array, 0);
+ return array;
+ }
+
+ private static ArrayList FindInternal(string key, bool searchAllChildren, Control.ControlCollection controlsToLookIn, ArrayList foundControls)
+ {
+ if (controlsToLookIn == null || foundControls == null)
+ {
+ return null;
+ }
+
+ try
+ {
+ for (int i = 0; i < controlsToLookIn.Count; i++)
+ {
+ if (controlsToLookIn[i] != null && controlsToLookIn[i].Tag != null && string.Compare(controlsToLookIn[i].Tag.ToString(), key) == 0)
+ {
+ foundControls.Add(controlsToLookIn[i]);
+ }
+ }
+
+ if (searchAllChildren)
+ {
+ for (int j = 0; j < controlsToLookIn.Count; j++)
+ {
+ if (controlsToLookIn[j] != null && controlsToLookIn[j].Controls != null && controlsToLookIn[j].Controls.Count > 0)
+ {
+ foundControls = FindInternal(key, searchAllChildren, controlsToLookIn[j].Controls, foundControls);
+ }
+ }
+
+ return foundControls;
+ }
+
+ return foundControls;
+ }
+ catch (Exception ex)
+ {
+ return foundControls;
+ }
+ }
+
+
public static Control FindControl(Control control,string name)
{
Control[] controls = control.Controls.Find(name, true);