Properties.Setting.Default保存配置信息的方法
2012-04-06 13:32
387 查看
Properties.Setting.Default保存配置信息的方法
1.定义---将保存信息在Properties.Setting.Designer.cs中定义
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("30.93")]
public double MainMapLat
{
get
{
return ((double)(this["MainMapLat"]));
}
set
{
this["MainMapLat"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("115.10")]
public double MainMapLng
{
get
{
return ((double)(this["MainMapLng"]));
}
set
{
this["MainMapLng"] = value;
}
}
2.保存---windform窗体关闭时将当前Lat,Lng保存
Properties.Settings.Default.MainMapLat = MainMap.Position.Lat;
Properties.Settings.Default.MainMapLng = MainMap.Position.Lng;
Properties.Settings.Default.Save();
3.获取-- cs文件直接使用
double theCenterLat = Properties.Settings.Default.MainMapLat;
double theCenterLng = Properties.Settings.Default.MainMapLng;
1.定义---将保存信息在Properties.Setting.Designer.cs中定义
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("30.93")]
public double MainMapLat
{
get
{
return ((double)(this["MainMapLat"]));
}
set
{
this["MainMapLat"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("115.10")]
public double MainMapLng
{
get
{
return ((double)(this["MainMapLng"]));
}
set
{
this["MainMapLng"] = value;
}
}
2.保存---windform窗体关闭时将当前Lat,Lng保存
Properties.Settings.Default.MainMapLat = MainMap.Position.Lat;
Properties.Settings.Default.MainMapLng = MainMap.Position.Lng;
Properties.Settings.Default.Save();
3.获取-- cs文件直接使用
double theCenterLat = Properties.Settings.Default.MainMapLat;
double theCenterLng = Properties.Settings.Default.MainMapLng;
相关文章推荐
- 4、在MyJDBCUtils中加入Properties保存数据库的配置信息
- 在使用servlet时读取database.properties数据库配置文件信息方法
- Android 使用Properties文件保存软件配置信息
- 42-IO流(Properties集合的-基本功能). 44-IO流(Properties集合的-store方法) load方法 45-IO流(Properties集合的-修改配置信息)
- BCB中保存配置信息的几种方法
- Java中从properties配置文件中读取信息的几种方法
- 一种比“ini配置文件”和“注册表”更好用的保存“初始化信息”的方法—CArchive类
- BCB中保存配置信息的几种方法
- 如何在spring中读取properties配置文件里面的信息
- 利用Java的Properties 类读取配置文件信息
- GRUB2的配置方法【涉及/etc/default/grub,/etc/grub.d/*】
- 重写系统Crash处理类,保存Crash信息到SD卡 和 完美退出程序的方法
- 查看Linux 硬件配置信息的方法详解
- Android 配置打包签名信息的两种方法
- 使用配置文件保存连接数据库的字符串的方法
- Oracle数据库的网络连接配置以及一些常见错误信息解决方法
- log4J 日志信息log4j.properties配置说明
- C# Devexpress 中GridControl 视图信息配置保存/加载
- Android 重写系统Crash处理类,保存Crash信息到SD卡 和 完美退出程序的方法
- 配置文件读取的一种方法config.properties