Пример #1
0
            protected override void Write()
            {
                if (_form.WindowState != FormWindowState.Minimized)
                {
                    ControlPreferences.SetValue(Name, "State", _form.WindowState.ToString());
                }

                if (_form.WindowState == FormWindowState.Normal)
                {
                    int x = _form.DesktopBounds.X;
                    int y = _form.DesktopBounds.Y;

                    if (x < -30000)
                    {
                        x = 50;
                    }
                    if (y < -30000)
                    {
                        y = 50;
                    }

                    ControlPreferences.SetValue(Name, "X", x.ToString(Culture));
                    ControlPreferences.SetValue(Name, "Y", y.ToString(Culture));

                    if (_form.FormBorderStyle == FormBorderStyle.Sizable || _form.FormBorderStyle == FormBorderStyle.SizableToolWindow)
                    {
                        ControlPreferences.SetValue(Name, "Width", _form.DesktopBounds.Width.ToString(Culture));
                        ControlPreferences.SetValue(Name, "Height", _form.DesktopBounds.Height.ToString(Culture));
                    }
                }
                else
                {
                    ControlPreferences.SetValue(Name, "X", _form.RestoreBounds.X.ToString(Culture));
                    ControlPreferences.SetValue(Name, "Y", _form.RestoreBounds.Y.ToString(Culture));

                    if (_form.FormBorderStyle == FormBorderStyle.Sizable || _form.FormBorderStyle == FormBorderStyle.SizableToolWindow)
                    {
                        ControlPreferences.SetValue(Name, "Width", _form.RestoreBounds.Width.ToString(Culture));
                        ControlPreferences.SetValue(Name, "Height", _form.RestoreBounds.Height.ToString(Culture));
                    }
                }
            }
Пример #2
0
 protected override void Write()
 {
     ControlPreferences.SetValue(Name, "SplitterDistance", _splitContainer.SplitterDistance.ToString(Culture));
 }