private void AppliationProperties_Load(object sender, EventArgs e) { //create & fill the table. PropertyTable proptable = new PropertyTable(); //Construct PropertyTable entries from Settings class user-scoped properties VoodooPOS.Properties.Settings settings = VoodooPOS.Properties.Settings.Default; Type type = typeof(Properties.Settings); MemberInfo[] pi = type.GetProperties(); foreach (MemberInfo m in pi) { Object[] myAttributes = m.GetCustomAttributes(true); if (myAttributes.Length > 0) { for (int j = 0; j < myAttributes.Length; j++) { if (myAttributes[j].ToString() == "System.Configuration.UserScopedSettingAttribute") { PropertySpec ps = new PropertySpec("property name", "System.String"); switch (m.Name) { //Files category case "BackgroundImagePath": ps = new PropertySpec( "Background Image Path", "System.String", "File Locations", "Background Image Path", settings.BackgroundImagePath.ToString(), typeof(System.Windows.Forms.Design.FileNameEditor), typeof(System.Convert)); break; case "LogoImagePath": ps = new PropertySpec( "Logo Image Path", "System.String", "File Locations", "Logo Image Path", settings.LogoImagePath.ToString(), typeof(System.Windows.Forms.Design.FileNameEditor), typeof(System.Convert)); break; case "ImageNotFoundImagePath": ps = new PropertySpec( "Image Not Found Image Path", "System.String", "File Locations", "Image Not Found Image Path", settings.ImageNotFoundImagePath.ToString(), typeof(System.Windows.Forms.Design.FileNameEditor), typeof(System.Convert)); break; //doubles case "TaxRate": ps = new PropertySpec( "Tax Rate", typeof(Double), "Admin Properties", "Tax Rate", settings.TaxRate.ToString()); break; case "MinimumCreditCharge": ps = new PropertySpec( "Minimum Credit Charge", typeof(Double), "Admin Properties", "Minimum sale amount allowed to pay with a credit card", settings.MinimumCreditCharge); break; case "EndOfBusinessDay24HourTime": ps = new PropertySpec( "End Of Business Day - 24 Hour Time", typeof(Int32), "Admin Properties", "The time of day considered EOB - 24 Hour Time", settings.EndOfBusinessDay24HourTime); break; //Colors //case "pec_color": // ps = new PropertySpec( // "PEC Color", // typeof(System.Drawing.Color), // "Colors", // "Color used for PEC model elements", // settings.pec_color); // break; //Fonts //case "default_plot_font": // ps = new PropertySpec( // "Default Plot Font", // typeof(Font), // "Fonts", // "Default font used for 2-D plots", // settings.default_plot_font); // break; } proptable.Properties.Add(ps); } } } } //this line binds the PropertyTable object to the preferences PropertyGrid control this.propertyGrid1.SelectedObject = proptable; }