The main secondary function is achieved by reading and writing forms in the registry the Location property. In the form of closed form FormClosed pretreatment event, the Location attribute values in the form of written to the registry, and then reads the saved data from the registry in the Load event of the form. ( . 1 ) the Location attribute Point a result, the upper left corner of the window relative coordinates of the upper left corner of the desktop. ( 2 ) read the registry c # in the registry write, SetValue and GetValue mainly by class methods RegistryKey achieved. Code /// <Summary> /// Get the last position at the end of the form when the form is loaded /// </ Summary> /// <param name = "SENDER"> </ param> /// <param = name "E"> </ param> Private void the Form1_Load ( Object SENDER, EventArgs E) { the RegistryKey myReg1, myReg2; // declare registry object myReg1 = Registry.CurrentUser;Gets the current user registry key is the try { myReg2 = myReg1.CreateSubKey ( " Software \\ MySoft " ); // create a sub-key in the registry entries in the this .location = new new Point (Convert.ToInt16 (myReg2.GetValue ( " 1 " )), Convert.ToInt16 (myReg2.GetValue ( " 2 " ))); // set the display position of the window } the catch { } } /// <Summary> /// form before it shuts down the current position of the form /// </ Summary> /// <param name = "SENDER"> </ param> /// <param name = "E"> </param> private void Form1_FormClosed ( Object SENDER, FormClosedEventArgs E) { the RegistryKey myReg1, myReg2; // declare registry object myReg1 = Registry.CurrentUser; // get the current user registry entry myReg2 = myReg1.CreateSubKey ( " Software \\ MySoft " ); / / created in the registry key subkey the try { myReg2.SetValue ( " . 1 " , the this .Location.X.ToString ()); myReg2.SetValue ( " 2 " , the this .Location.Y.ToString ()); } the catch { } }