比如获取Button按钮:

System.Reflection.FieldInfo[] fieldInfo = form.GetType().GetFields(System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
for (int i = 0; i < fieldInfo.Length; i++)
{
switch (fieldInfo[i].FieldType.Name)
{
case "Button":
{
Button btn= (Button)fieldInfo[i].GetValue(form);
break;
}
}
}

相关文章:

  • 2021-11-25
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
相关资源
相似解决方案