예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!DesignMode)
            {
                this.UpdateDockPanel(ReferenceDockPanel());
                if (!SavedDockStates.ContainsKey(BaseFormID()))
                {
                    var newSetting = new BaseFormSetting {
                        DockState = DockState.Document
                    };
                    SavedDockStates.Add(BaseFormID(), newSetting);
                }
                var setting = SavedDockStates[BaseFormID()];
                if (setting.DockState == DockState.Unknown)
                {
                    setting.DockState = DockState.Document;
                }


                if (setting.DockState == DockState.Float)
                {
                    Top    = setting.Top;
                    Left   = setting.Left;
                    Width  = setting.Width;
                    Height = setting.Height;
                    this.EnsureFitsInDesktop();
                }
                this.UpdateDockState(setting.DockState);
            }
        }
예제 #2
0
 public static void LoadDockStates()
 {
     SavedDockStates = new Dictionary <string, BaseFormSetting>();
     try
     {
         var saved     = Settings.Default.BaseFormDockStates;
         var savedRows = saved.Split(RowSeparator, StringSplitOptions.RemoveEmptyEntries);
         foreach (var savedRow in savedRows)
         {
             var savedCells = savedRow.Split(ColumnSeparator, StringSplitOptions.RemoveEmptyEntries);
             var loaded     = new BaseFormSetting {
                 DockState = ((DockState)Enum.Parse(typeof(DockState), savedCells[1])), Top = int.Parse(savedCells[2]), Left = int.Parse(savedCells[3]), Width = int.Parse(savedCells[4]), Height = int.Parse(savedCells[5])
             };
             SavedDockStates.Add(savedCells[0], loaded);
         }
     }
     catch
     {
         SavedDockStates.Clear();
     }
 }