我使用Properties.Settings.Default保存程序的用户设置。这包括主窗口的大小和位置。看这里的图片。它们表示我调用时所签名的默认值。
Properties.Settings.Default.Reset();
当我打电话的时候
Properties.Settings.Default.Height = 25;
例如,通过调用
Properties.Settings.Default.Save();
当我现在进行reset()和save()时,我在图片中选择的默认值将在调用时再次返回
Properties.Settings.Default.Height;
如何在运行时期间更改这些默认值,以便在调用reset()时,采用新分配的值?(即使当我关闭程序并再次重新打开时。因此,它也应该在图片中更新)
发布于 2021-02-17 11:21:41
如果参数范围设置为User,则更改Settings.Default不应该是一个问题。应用程序范围中的参数是只读的.这是我的装置。
然后,我在公共字段中使用它进行双向绑定,就像这样。
public double CurrRateRubToUSD
{
get
{
return Properties.Settings.Default.CurrencyRateRubToUSD;
}
set
{
if (value != Properties.Settings.Default.CurrencyRateRubToUSD)
{
Properties.Settings.Default.CurrencyRateRubToUSD = value;
Properties.Settings.Default.Save();
Properties.Settings.Default.Reload();
}
}
}
https://stackoverflow.com/questions/45571940
复制相似问题