public void ReadFormSettings(System.Windows.Forms.Form form)
{
string windowStateString = this.Read(form.Name + "WindowState");
System.Windows.Forms.FormWindowState windowState = System.Windows.Forms.FormWindowState.Normal;
if (windowStateString.Length > 0)
{
windowState = (System.Windows.Forms.FormWindowState)Convert.ToInt32(windowStateString);
}
if (windowState == System.Windows.Forms.FormWindowState.Maximized)
{
form.WindowState = windowState;
}
else
{
string valuesString = this.Read(form.Name);
if (valuesString.Length > 0)
{
string[] values = valuesString.Split(Convert.ToChar(","));
form.Top = Convert.ToInt16(values[0]);
form.Left = Convert.ToInt16(values[1]);
int width = Convert.ToInt16(values[2]);
if (width > 0) form.Width = width;
int height = Convert.ToInt16(values[3]);
if (height > 0) form.Height = height;
}
}
}