//*************************************************************************** // Static Methods // public static void SetAllFlatStyles(Control.ControlCollection controls, FlatStyle value) { foreach (Control cn in controls) { Type cnType = cn.GetType(); //System.Reflection.PropertyInfo pi = cnType.GetProperty("FlatStyle"); System.Reflection.MemberInfo[] pi = cnType.FindMembers(System.Reflection.MemberTypes.Property, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, System.Type.FilterNameIgnoreCase, "FlatStyle"); if (pi != null && pi.Length > 0) { if (cnType.FullName != "RainstormStudios.Controls.AdvancedButton") { ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, value, null); } else if (cnType.FullName == "RainstormStudios.Controls.AdvancedButton") { try { AdvancedButton.AdvButtonStyle btnStyle = (AdvancedButton.AdvButtonStyle)Enum.Parse(typeof(AdvancedButton.AdvButtonStyle), value.ToString()); ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, btnStyle, null); } finally { } } } if (cn.Controls.Count > 0) { RsUserControlBase.SetAllFlatStyles(cn.Controls, value); } } }
public static void SetAllForegroundColor(Control.ControlCollection controls, Color value) { foreach (Control cn in controls) { string cnTypeName = cn.GetType().Name; if (!_nClr.Contains(cnTypeName)) { cn.ForeColor = value; } if (cn.Controls.Count > 0) { RsUserControlBase.SetAllForegroundColor(cn.Controls, value); } } }