AEMManager.Util.SystemUtil.SaveWindowPos C# (CSharp) Method

SaveWindowPos() public static method

Saved current position/state of given form in registry.
public static SaveWindowPos ( Form pfrm ) : void
pfrm System.Windows.Forms.Form Form instance
return void
        public static void SaveWindowPos(Form pfrm)
        {
            RegistryKey key = RegistryUtil.GetUserKey(pfrm);

              if (pfrm.MaximizeBox) {
            if (pfrm.WindowState != FormWindowState.Minimized) {
              key.SetValue("WindowPos_WindowState", (int)pfrm.WindowState);
            }
            pfrm.WindowState = FormWindowState.Normal;
              }

              key.SetValue("WindowPos_WindowX", pfrm.Location.X);
              key.SetValue("WindowPos_WindowY", pfrm.Location.Y);

              if (pfrm.FormBorderStyle == FormBorderStyle.Sizable || pfrm.FormBorderStyle == FormBorderStyle.SizableToolWindow) {
            key.SetValue("WindowPos_WindowWidth", pfrm.Size.Width);
            key.SetValue("WindowPos_WindowHeight", pfrm.Size.Height);
              }

              key.Close();
        }