winform自动保存属性变更

1.每次变更都保存

Properties.Settings.Default.PropertyChanged += Default_PropertyChanged;

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

2. 退出时保存

Application.ApplicationExit += new EventHandler(Application_ApplicationExit);

void Application_ApplicationExit(object sender, EventArgs e)
{
    Settings.Default.Save();
}

 

posted @ 2016-06-13 10:56  楊柳  阅读(334)  评论(0编辑  收藏  举报