winform自動保存屬性變動

1.每次變動都保存spa

Properties.Settings.Default.PropertyChanged += Default_PropertyChanged;

private void Default_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
    Properties.Settings.Default.Save();
}

2. 退出時保存code

Application.ApplicationExit += new EventHandler(Application_ApplicationExit);

void Application_ApplicationExit(object sender, EventArgs e)
{
    Settings.Default.Save();
}
相關文章
相關標籤/搜索