C# 通过反射获取winform上的控件
2021-05-18 14:30
标签:value switch win ase winform get system flag name 比如获取Button按钮: System.Reflection.FieldInfo[] fieldInfo = form.GetType().GetFields(System.Reflection.BindingFlags.NonPublic | C# 通过反射获取winform上的控件 标签:value switch win ase winform get system flag name 原文地址:https://www.cnblogs.com/lihaishu/p/11737202.html
System.Reflection.BindingFlags.Instance);
for (int i = 0; i {
switch (fieldInfo[i].FieldType.Name)
{
case "Button":
{
Button btn= (Button)fieldInfo[i].GetValue(form);
break;
}
}
}
文章标题:C# 通过反射获取winform上的控件
文章链接:http://soscw.com/index.php/essay/87232.html