Ejemplo n.º 1
0
        public static T GetNextControl <T>(
            Control parent,
            T curr,
            bool recursive,
            bool forward,
            bool wrap)
            where T : Control
        {
            if (parent == null || (object)curr == null)
            {
                return(default(T));
            }
            List <T> childControls = ControlHelper.GetChildControls <T>(parent, recursive);
            int      num           = childControls.IndexOf(curr);

            if (num < 0)
            {
                return(default(T));
            }
            int count = childControls.Count;
            int index;

            if (forward)
            {
                index = num + 1;
                if (index > count - 1)
                {
                    if (!wrap)
                    {
                        return(default(T));
                    }
                    index = 0;
                }
            }
            else
            {
                index = num - 1;
                if (index < 0)
                {
                    if (!wrap)
                    {
                        return(default(T));
                    }
                    index = count - 1;
                }
            }
            return(childControls[index]);
        }
Ejemplo n.º 2
0
 public static List <T> GetChildControls <T>(Control parent) where T : Control
 {
     return(ControlHelper.GetChildControls <T>(parent, false));
 }