日期:2014-05-16 浏览次数:20984 次
this.FindName("button" + Count) as Button
/// <summary>
/// 通过控件名获取控件
/// </summary>
/// <param name="strName"></param>
/// <returns></returns>
private Control GetPbControl(string strName)
{
string pbName = strName;
return GetControl(this, pbName);
}
/// <summary>
/// 通过控件名获取控件
/// </summary>
/// <param name="ct">控件所在的容器或者窗体</param>
/// <param name="name">需要查找的控件名</param>
/// <returns></returns>
public static Control GetControl(Control ct, string name)
{
Control[] ctls = ct.Controls.Find(name, false);
if (ctls.Length > 0)
{
return ctls[0];
}
else
{
return null;
}
&nb