IPersistComponentSettings is defined by MSDN as a standard functionality for controls or libraries that store and retrieve application settings. Yes, MSDN does define it and it shows you all the properties and methods on the interface, however it does not tell you how to use it at all.
In the simplest case you need a class which inherits from System.Configuration.ApplicationSettingsBase to store your settings. Your control (or UserControl) needs to implement the IPersistComponentSettings and have it’s SaveSettings property set to true. It is also a good idea to set the SettingsKey property to something specific. The name of control seems to work fine.
LoadComponentSettings(): retrieve your properties from the ApplicationSettingsBase class and set the values on the control.
SaveComponentSettings(): set the properties on the ApplicationSettingsBase class and then call the Save() method on that class.
ResetComponentSettings(): call Reset() on the ApplicationSettingsBase class.
I have not figured out how or if something else should be forcing a save by calling SaveComponentSettings automatically, so in my control I added an override to the Dispose method and call SaveComponentSettings myself.
IPersistComponentSettingsExample.zip (14.72 kb)