SIL.FieldWorks.Common.Controls.Persistence.SaveWindowPosition C# (CSharp) Method

SaveWindowPosition() public method

Save the top, left, width, and height of the window to the registry.
public SaveWindowPosition ( RegistryKey key ) : void
key Microsoft.Win32.RegistryKey The Registry Key.
return void
		public void SaveWindowPosition(RegistryKey key)
		{
			CheckDisposed();

			if ((m_normalWidth == 0 || m_normalHeight == 0) && Parent != null)
			{
				// make sure that we have a width and height set
				m_normalLeft = (Parent is Form ?
					((Form)Parent).DesktopBounds.Top : Parent.Left);

				m_normalTop = (Parent is Form ?
					((Form)Parent).DesktopBounds.Top : Parent.Top);

				m_normalWidth = (Parent is Form ?
					((Form)Parent).DesktopBounds.Width : Parent.Width);

				m_normalHeight = (Parent is Form ?
					((Form)Parent).DesktopBounds.Height : Parent.Height);
			}

			key.SetValue(Parent.GetType().Name + "Top", m_normalTop);
			key.SetValue(Parent.GetType().Name + "Left", m_normalLeft);
			key.SetValue(Parent.GetType().Name + "Width", m_normalWidth);
			key.SetValue(Parent.GetType().Name + "Height", m_normalHeight);
		}