如何在 C# 中保存设置
我正在构建一个独立的程序,因此没有外部文件可供程序访问。回忆上次关闭之前窗口的大小以及窗口内某个元素的位置的最佳方法是什么?
I am building a stand alone program so there are no external files for the program to access. What would be the best way to recall what the size of the window, and the location of a certain element inside the window were prior the the last shut down?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
内置的设置机制: http://msdn .microsoft.com/en-us/library/aa730869%28v=vs.80%29.aspx
The built in Settings mechanism: http://msdn.microsoft.com/en-us/library/aa730869%28v=vs.80%29.aspx
我会使用 .NET 提供的设置来完成此操作,这非常舒适:
http://msdn.microsoft.com/en -us/library/aa730869%28v=vs.80%29.aspx
I would do it with Settings provided by .NET, that's quiet comfortable:
http://msdn.microsoft.com/en-us/library/aa730869%28v=vs.80%29.aspx
好吧,我认为选项有两个:
对于第一个选项,请查看MSDN,对于第二个选项,请尝试查看< a href="http://msdn.microsoft.com/en-us/library/2kzb96fk.aspx" rel="nofollow">此处。
编辑:如何写入注册表:
Well, I think the options are two:
For the first option look at MSDN, for the second try to look here.
EDIT: How to write into the registry: