示例#1
0
        public static List <T> FindControls <T>(Control seed, string typeFullName, bool shallow) where T : Control
        {
            if (seed == null || string.IsNullOrEmpty(typeFullName))
            {
                return(null);
            }

            List <T> foundControls = new List <T>();

            foreach (Control control in seed.Controls)
            {
                if (ReflectionUtils.IsTypeOf(control, typeFullName, shallow))
                {
                    foundControls.Add(control as T);
                }

                if (ControlUtils.HasControls(control))
                {
                    foundControls.AddRange(ControlUtils.FindControls <T>(control, typeFullName, shallow));
                }
            }

            return(foundControls);
        }
示例#2
0
        public static List <T> FindControls <T>(Control seed, bool shallow) where T : Control
        {
            if (seed == null)
            {
                return(null);
            }

            List <T> foundControls = new List <T>();

            foreach (Control control in seed.Controls)
            {
                if (ReflectionUtils.IsTypeOf(control, typeof(T), shallow))
                {
                    foundControls.Add(control as T);
                }

                if (ControlUtils.HasControls(control))
                {
                    foundControls.AddRange(ControlUtils.FindControls <T>(control, shallow));
                }
            }

            return(foundControls);
        }