WindowState 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package WindowState --version 1.0.0                
NuGet\Install-Package WindowState -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WindowState" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WindowState --version 1.0.0                
#r "nuget: WindowState, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WindowState as a Cake Addin
#addin nuget:?package=WindowState&version=1.0.0

// Install WindowState as a Cake Tool
#tool nuget:?package=WindowState&version=1.0.0                

WindowState

Library to help save window state of WinForms windows. It will store Size, Location, FormWindowState (Normal, Minimized, Maximized), ColumnHeader.Width and SplitContainer.Distance. WindowStates can be put directly into settings.

Usage

Load

Requires a bit more code then I would like atm. I wanna improve this.

Anyway, initialize a WindowStates collection and add a Form:

var settings = Properties.Settings.Default;

// Initialize WindowStates collection if null
if (settings.WindowStates == null)
{
    settings.WindowStates = new WindowStates();
}

// Add WindowState for form if WindowStates doesn't have a entry for it
if (!settings.WindowStates.Contains(this.Name))
{
    settings.WindowStates.Add(this.Name);
}

Now we can restore window state like this:

settings.WindowStates[this.Name].RestoreForm(this);

Save

Simply:

settings.WindowStates[this.Name].SaveForm(this);

RestoreForm() & SaveForm() have a second parameter for saving colum widths. Defaults to true.

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 2,973 10/17/2017
1.1.1 943 10/10/2017
1.1.0 950 10/10/2017
1.0.0 940 10/10/2017

Initial release.