递归获得当前窗体的焦点控件 - ControlFocusedGet
2017-05-20 13:17:09 访问(1378) 赞(0) 踩(0)
/// <summary>
/// 递归获得当前窗体的焦点控件 - ControlFocusedGet
/// </summary>
/// <param name="pCtrl"></param>
/// <returns></returns>
public Control ControlFocusedGet(Control pCtrl)
{
if (pCtrl.Focused)
return pCtrl;
Control theResult = null;
foreach (Control c in pCtrl.Controls)
{
if (c == null)
continue;
theResult = ControlFocusedGet(c);
if (theResult != null)
return theResult;
}
return null;
}
标签:
递归获得当前窗体的焦点控件 - ControlFocusedGet 


上一条:
下一条:
相关评论
发表评论