首页 / 知识

关于.net:将Windows Forms属性绑定到C#中的ApplicationSettings的最佳方法?

2023-04-12 15:45:00

关于.net:将Windows Forms属性绑定到C#中的ApplicationSettings的最佳方法?

Best way to bind Windows Forms properties to ApplicationSettings in C#?

在需要进行认真重构的桌面应用程序中,我有几段看起来像这样的代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
private void LoadSettings()
{
    WindowState = Properties.Settings.Default.WindowState;
    Location = Properties.Settings.Default.WindowLocation;
    ...
}

private void SaveSettings()
{
    Properties.Settings.Default.WindowState = WindowState;
    Properties.Settings.Default.WindowLocation = Location;
    ...
}

替代此方法的最佳方法是什么?项目施加的约束:

  • Visual Studio 2005
  • C#/。NET 2.0
  • Windows表格

更新

为方便起见,我还找到了两个有用的教程:" C#中的Windows窗体用户设置"和"探索持久性应用程序设置的秘密"。

我在这里问了有关使用此技术绑定表格大小的后续问题。我将它们分离出来,以帮助寻找类似问题的人们。
-------------------



方法绑定属性应用程序

最新内容

相关内容

热门文章

推荐文章

标签云

猜你喜欢