读取注册表中的指定软件的路径
/// <summary>
/// 读取注册表中的制定软件的路径
/// </summary>
/// <param name="sKey"></param>
/// <returns></returns>
private string ReadRegistry(string sKey)
{
//Open the subkey for reading
Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sKey, true);
if (rk == null) return "";
// Get the data from a specified item in the key.
return (string)rk.GetValue("InstallDir");
}
调用方法
string sInstall = ReadRegistry("SOFTWARE\\ESRI\\CoreRuntime");
this.axSymbologyControl1.LoadStyleFile(sInstall + "http://www.cnblogs.com/hongzhi/admin/file://styles//ESRI.ServerStyle");