Beispiel #1
0
        //----------------------------------------------------------------------
        public void PrefSave()
        {
            SaveFiles sv = new SaveFiles("MamiSun");

            sv.SetStr("aerender", aerenderListbox1.aerenderPath);
            sv.SetInt("Width", this.Width);
            sv.SetInt("Height", this.Height);
            sv.SetInt("Left", this.Left);
            sv.SetInt("Top", this.Top);

            sv.SaveToFile(prefFile);
        }
Beispiel #2
0
        //----------------------------------------------------------------------
        public void PrefLoad()
        {
            SaveFiles sv = new SaveFiles("MamiSun");

            sv.LoadFromFile(prefFile);
            aerenderListbox1.aerenderPath = sv.GetStr("aerender", "");

            int w, h, t, l;

            w = sv.GetInt("Width", 0);
            h = sv.GetInt("Height", 0);
            t = sv.GetInt("Top", -999);
            l = sv.GetInt("Left", -999);
            this.SuspendLayout();
            if (w >= 520)
            {
                this.Width = w;
            }
            if (h >= 720)
            {
                this.Height = h;
            }
            if (t != -999)
            {
                this.Top = t;
            }
            if (l != -999)
            {
                this.Left = l;
            }
            //中央表示
            int dt = System.Windows.Forms.Screen.GetBounds(this).Top;
            int dl = System.Windows.Forms.Screen.GetBounds(this).Left;
            int dh = System.Windows.Forms.Screen.GetBounds(this).Height;
            int dw = System.Windows.Forms.Screen.GetBounds(this).Width;

            if ((this.Left <= dl) || (this.Top <= dt))
            {
                this.Top  = dt + (dh - this.Height) / 2;
                this.Left = dl + (dw - this.Width) / 2;
            }
            this.ResumeLayout();
        }