C# Class Smrf.AppLib.FormSettings

Saves a form's window state and rectangle in the user's settings.
This can be used as a base class for storing user settings in a Windows Forms application. This class automatically saves the window state, location, and optionally size (if the form is resizable) of a specified form when the form closes, and restores them when the form is loaded.

Derive a class from this one, add any form-specific user setting properties to the derived class, instantiate the dervied class in the form's constructor, and save the instantiated object in a member field.

It is not necessary to call ApplicationSettingsBase.Save when the form is closing. This class does that automatically.

This is for .NET 2.0 and later applications only.

Inheritance: System.Configuration.ApplicationSettingsBase
Show file Open project: 2014-sed-team3/term-project

Protected Properties

Property Type Description
m_bFormIsFixedSize System.Boolean

Private Properties

Property Type Description
AssertValid void

Public Methods

Method Description
FormSettings ( Form form, System.Boolean formIsFixedSize ) : System

Initializes a new instance of the FormSettings class.

Protected Methods

Method Description
Form_FormClosing ( object sender, FormClosingEventArgs e ) : void
Form_Load ( object sender, EventArgs e ) : void
RestoreFormWindow ( Form oForm ) : void
SaveFormWindow ( Form oForm ) : void

Private Methods

Method Description
AssertValid ( ) : void

Method Details

FormSettings() public method

Initializes a new instance of the FormSettings class.
public FormSettings ( Form form, System.Boolean formIsFixedSize ) : System
form System.Windows.Forms.Form /// The form to save settings for. ///
formIsFixedSize System.Boolean /// true if is of fixed size, false if it is /// resizable. If false, the form's size is restored along with the form's /// window state and location. ///
return System

Form_FormClosing() protected method

protected Form_FormClosing ( object sender, FormClosingEventArgs e ) : void
sender object
e System.Windows.Forms.FormClosingEventArgs
return void

Form_Load() protected method

protected Form_Load ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

RestoreFormWindow() protected method

protected RestoreFormWindow ( Form oForm ) : void
oForm System.Windows.Forms.Form
return void

SaveFormWindow() protected method

protected SaveFormWindow ( Form oForm ) : void
oForm System.Windows.Forms.Form
return void

Property Details

m_bFormIsFixedSize protected property

protected Boolean,System m_bFormIsFixedSize
return System.Boolean