UIPSnap (User Interface Property Snap) is a library for serializing the state of windows forms and controls recursively to XML by reading and writing properties of certain types on a best-effort basis using reflection. It's very simple to use and yet provides some interesting possibilities of customizing.
There are some rules:
The first thing to do is to download the library and copy the UIPSnap.dll into your VS Windows Forms project folder. The add a project reference to the dll.
The next thing to do is to to select each control in the form's edtior and enter a number into the Tag field. The number defines the order in which controls are handled! If the order is not important, just set every tag field to 0.
Furthermore, please ensure that each control has a unique Name property! This is important since each control is identified by its name.
Having all controls tagged, you can start coding. Use the toXML and fromXML methods to save and restore the UI state of your controls. You may also use some of the filter methods to gain more control over which properties you actually want to handle. Please refer to the API documentation of the UIPSnap class for this and see the code examples below.
Example 1: Save UI state in form closing handler.
Example 2: Restore UI state in form shown handler.
Example 3: Remove string type from default type list (no string type properties will be handled).
Example 4: Add visibility property name no exclude list (no visibility states will be handled).
Example 5: Add visibility property name no include list (Only visibility states will be handled).