比如獲取Button按鈕: System.Reflection.FieldInfo[] fieldInfo = form.GetType().GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingF ...
比如獲取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;
}
}
}