//------------------------------------------------------------- /// <summary> /// フォームが閉じられた時 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_FormClosed(object sender, FormClosedEventArgs e) { //設定ファイルの保存 PrefFile pref = new PrefFile(); pref.SetSize("Size", this.Size); pref.SetPoint("Point", this.Location); pref.Save(); }
protected override void OnFormClosed(FormClosedEventArgs e) { base.OnFormClosed(e); PrefFile pref = new PrefFile(); pref.SetSize("Size", this.Size); pref.SetPoint("Point", this.Location); pref.Save(); }
//------------------------------------------------------------- /// <summary> /// フォームが閉じられた時 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { //設定ファイルの保存 PrefFile pref = new PrefFile(); pref.SetSize("Size", this.Size); pref.SetPoint("Point", this.Location); pref.SetNum("index", memoEditList1.SelectedMemoIndex); pref.SetStr("font", memoEditList1.TextFont.Name); pref.SetNum("fontsize", memoEditList1.TextFont.Size); pref.SetBool("IsEncodeUTF-8", encodeUTF8CMenu.Checked); pref.Save(); string pp = Path.Combine(pref.PrefFolder, "Memos.json"); memoEditList1.SaveAll(pp); }
//------------------------------------------------------------- /// <summary> /// フォーム作成時に呼ばれる /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_Load(object sender, EventArgs e) { //設定ファイルの読み込み PrefFile pref = new PrefFile(); if (pref.Load()) { Size sz; if (pref.GetSize("Size", out sz)) { this.Size = sz; } Point p; if (pref.GetPoint("Point", out p)) { this.Location = p; } double v = -1; if (pref.GetNum("index", out v)) { if (v >= 0) { memoEditList1.SelectedMemoIndex = (int)v; } } string s = ""; double f = 14; if (pref.GetStr("font", out s) && pref.GetNum("fontsize", out f)) { memoEditList1.TextFont = new Font(s, (float)f); } bool b = true; if (pref.GetBool("IsEncodeUTF-8", out b)) { encodeUTF8CMenu.Checked = b; encodeShftJISCMenu.Checked = !b; } } this.Text = Path.GetFileNameWithoutExtension(Application.ExecutablePath); string pp = Path.Combine(pref.PrefFolder, "Memos.json"); if (File.Exists(pp)) { memoEditList1.LoadAll(pp); } }
//------------------------------------------------------------- /// <summary> /// フォーム作成時に呼ばれる /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { //設定ファイルの読み込み PrefFile pref = new PrefFile(); if (pref.Load()) { Size sz; if (pref.GetSize("Size", out sz)) { this.Size = sz; } Point p; if (pref.GetPoint("Point", out p)) { this.Location = p; } } this.Text = Path.GetFileNameWithoutExtension(Application.ExecutablePath); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); PrefFile pref = new PrefFile(); if (pref.Load()) { Size sz; if (pref.GetSize("Size", out sz)) { this.Size = sz; } Point p; if (pref.GetPoint("Point", out p)) { this.Location = p; } } this.Text = Path.GetFileNameWithoutExtension(Application.ExecutablePath); }