Is there an easy way to wrap a "Preferences Panel" thing around the Settings.settings
file (or any other settings file)?
Basically I have a bunch of strings stored in Settings.settings
, and want to have a form where the user can edit these..
I could add a bunch of TextBoxes, and have a button that does Properties.blah = this.blahInput.Text; Properties.Save();
Properties.blah = this.blahInput.Text; Properties.Save();
for each, but this feels like reinventing the wheel..
Edit: The PropertyGrid control (as suggested by bassfriend's ) seems perfect, but I cannot work out how to bind the property grid's SelectedObject to Properties.Settings.Default
- When I try I get the following error:
Cannot implicitly convert type 'MyProject.Properties.Settings' to 'object[]'
也许你想看看PropertyGrid控件 。
I had no problem:
propertyGrid1.SelectedObject = Properties.Settings.Default;
I did have to change the visibility to Public in the Settings Designer.
Maybe you need to use the Settings.Default.Properties property? That returns SettingsPropertyCollection which should be convertable to an object[].
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.