Cохранения положения и размеров формы в реестре

private void Form1_Load(object sender, EventArgs e)
        {
            //чтение координат и размеров окна
            Microsoft.Win32.RegistryKey key;
            key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("MyApp-subkey");
            if (null != key.GetValue("Form1-X"))
            {
                Point tmpLocation = this.Location;
                tmpLocation.X = Convert.ToInt32(key.GetValue("Form1-X").ToString());
                tmpLocation.Y = Convert.ToInt32(key.GetValue("Form1-Y").ToString());
                this.Location = tmpLocation;
                this.Size = new System.Drawing.Size(Convert.ToInt32(key.GetValue("Form1-Width").ToString()),
                                                    Convert.ToInt32(key.GetValue("Form1-Height").ToString()));
            }
            key.Close();
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            //запись координат и размеров окна
            Microsoft.Win32.RegistryKey key;
            key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("MyApp-subkey");
            key.SetValue("Form1-X", Location.X);
            key.SetValue("Form1-Y", Location.Y);
            key.SetValue("Form1-Width", Size.Width);
            key.SetValue("Form1-Height", Size.Height);
            key.Close();
        }

Положение и размероы формы  при выходе из программы сохраняются и восстанавливаются  при запуске.