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;
}
用户登录
还没有账号?立即注册
用户注册
投稿取消
| 文章分类: |
|
还能输入300字
上传中....
利多卡因2812997