清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
public static T FindControl<T>(this Control control, Predicate<Control> expression) where T: Control { T tmp = null; if (control.HasControls()) { foreach (Control ctrl in control.Controls) { if (tmp == null) { if (ctrl is T) { if (expression == null || expression.Invoke(ctrl)) return (ctrl as T); } else { if (ctrl.HasControls()) tmp = FindControl<T>(ctrl as Control, expression); } } else break; } } return tmp; }