public SettingsForm() { InitializeComponent(); this.Icon = Icon.FromHandle( Properties.Resources.world.GetHicon() ); PropertyInfo[] props = typeof( Settings ).GetProperties( BindingFlags.Public | BindingFlags.Static ); foreach ( PropertyInfo pi in props ) { SettingAttribute[] setAttribs = ( SettingAttribute[] )pi.GetCustomAttributes( typeof( SettingAttribute ), false ); if ( setAttribs == null || setAttribs.Length == 0 ) continue; string text = setAttribs[ 0 ].Display; SettingBox sb = new SettingBox() { Text = text, Setting = pi, }; bool bEnabled = ( bool )pi.GetValue( null, null ); sb.Checked = bEnabled; settingsPanel.Controls.Add( sb ); } }
public SettingsForm() { InitializeComponent(); this.Icon = Icon.FromHandle(Properties.Resources.world.GetHicon()); PropertyInfo[] props = typeof(Settings).GetProperties(BindingFlags.Public | BindingFlags.Static); foreach (PropertyInfo pi in props) { SettingAttribute[] setAttribs = ( SettingAttribute[] )pi.GetCustomAttributes(typeof(SettingAttribute), false); if (setAttribs == null || setAttribs.Length == 0) { continue; } string text = setAttribs[0].Display; SettingBox sb = new SettingBox() { Text = text, Setting = pi, }; bool bEnabled = ( bool )pi.GetValue(null, null); sb.Checked = bEnabled; settingsPanel.Controls.Add(sb); } }