2011/8/3

windows form中用application settings來save settings

1.在application settings定義operation1
2.在close時儲存程式結束時的設定
private void form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            Properties.Settings.Default.operation1 = automaticToolStripMenuItem.Checked;
            Properties.Settings.Default.Save();
        }
3.在form load時讀取
private void form1_Activated(object sender, EventArgs e)
        {
             if (Properties.Settings.Default.operation1 != false)
            {
                soperationmode = "Automatic";
             }
            else
            {
                soperationmode = "Manual";
             }

沒有留言:

張貼留言