Esempio n. 1
0
 private void SetControlPropertyValue(string controlName, string propertyName, object newValue)
 {
     if (m_form.InvokeRequired)
     {
         Delegate d = new SetControlPropertyValueHandler(SetControlPropertyValue);
         object[] o = new object[] { controlName, propertyName, newValue };
         m_form.Invoke(d, o);
         resetEvent.WaitOne();
     }
     else
     {
         Type         t1   = m_form.GetType();
         FieldInfo    fi   = t1.GetField(controlName, flags);
         object       ctrl = fi.GetValue(m_form);
         Type         t2   = ctrl.GetType();
         PropertyInfo pi   = t2.GetProperty(propertyName);
         pi.SetValue(ctrl, newValue, null);
         resetEvent.Set();
     }
 }
Esempio n. 2
0
 private void SetControlPropertyValue(string controlName,string propertyName, object newValue)
 {
     if (m_form.InvokeRequired)
     {
         Delegate d = new SetControlPropertyValueHandler(SetControlPropertyValue);
         object[] o = new object[] { controlName, propertyName, newValue };
         m_form.Invoke(d, o);
         resetEvent.WaitOne();
     }
     else
     {
         Type t1 = m_form.GetType();
         FieldInfo fi = t1.GetField(controlName, flags);
         object ctrl = fi.GetValue(m_form);
         Type t2 = ctrl.GetType();
         PropertyInfo pi = t2.GetProperty(propertyName);
         pi.SetValue(ctrl, newValue, null);
         resetEvent.Set();
     }
 }