Exemple #1
0
 /// <inheritdoc />
 protected override void ContextLoad()
 {
     base.ContextLoad();
     if (manageDefault)
     {
         Context.LocationChanged += Parent_LocationChanged;
         sizeable = Context.ResizeMode == ResizeMode.CanResize || AlwaysTrackResize;
         if (sizeable)
         {
             Context.SizeChanged += Parent_SizeChanged;
         }
         if ((double)CustomSettings["Left"] != DEFAULT)
         {
             Context.Left = (double)CustomSettings["Left"];
         }
         if ((double)CustomSettings["Top"] != DEFAULT)
         {
             Context.Top = (double)CustomSettings["Top"];
         }
         if (sizeable)
         {
             try
             {
                 savedWidth = Context.Width; savedHeight = Context.Height;
                 if ((double)CustomSettings["Width"] != DEFAULT)
                 {
                     Context.Width = (double)CustomSettings["Width"];
                 }
                 if ((double)CustomSettings["Height"] != DEFAULT)
                 {
                     Context.Height = (double)CustomSettings["Height"];
                 }
                 Context.WindowState = (WindowState)CustomSettings["WindowState"];
             }
             catch
             {
                 CustomSettings.Reset();
                 Context.WindowState = (WindowState)CustomSettings["WindowState"];
             }
         }
         var newLoc = MoveIntoScreenBounds(Context);
         Context.Left = newLoc.X;
         Context.Top  = newLoc.Y;
     }
 }
Exemple #2
0
 /// <inheritdoc />
 protected override void ContextLoad()
 {
     base.ContextLoad();
     if (manageDefault)
     {
         Context.LocationChanged += Parent_LocationChanged;
         sizeable = Context.FormBorderStyle == FormBorderStyle.Sizable || AlwaysTrackResize;
         if (sizeable)
         {
             Context.SizeChanged += Parent_SizeChanged;
         }
         if ((int)CustomSettings["Left"] != DEFAULT)
         {
             Context.Left = (int)CustomSettings["Left"];
         }
         if ((int)CustomSettings["Top"] != DEFAULT)
         {
             Context.Top = (int)CustomSettings["Top"];
         }
         if (sizeable)
         {
             try
             {
                 savedWidth = Context.Width; savedHeight = Context.Height;
                 if ((int)CustomSettings["Width"] != DEFAULT)
                 {
                     Context.Width = (int)CustomSettings["Width"];
                 }
                 if ((int)CustomSettings["Height"] != DEFAULT)
                 {
                     Context.Height = (int)CustomSettings["Height"];
                 }
                 Context.WindowState = (FormWindowState)CustomSettings["WindowState"];
             }
             catch
             {
                 CustomSettings.Reset();
                 Context.WindowState = (FormWindowState)CustomSettings["WindowState"];
             }
         }
         Context.Location = MoveIntoScreenBounds(Context);
     }
 }