ArcGIS鼠标滚轮方向之代码篇

Desktop10.X有多个版本,不同版本的注册表路径不一致,注册表中可能残留多个版本的注册信息;也可能没有Desktop,而是Engine。其实可以通过RuntimeManager.ActiveRuntime的属性开判断版本、产品类型、甚至安装路径等。

/// <summary>
/// 修改滚轮方向
/// </summary>
/// <param name="flag">0:向前表示放大(常规习惯);1:向前表示缩小</param>
public static void ModifyWheel(int flag = 0)
{
    string path = @"Software\ESRI\" + RuntimeManager.ActiveRuntime.Product + RuntimeManager.ActiveRuntime.Version + @"\ArcMap\Settings" ;
    RegistryKey setKey = Registry.CurrentUser.OpenSubKey(path, true) ?? Registry.CurrentUser.CreateSubKey(path);
    setKey?.SetValue("ReverseMouseWheel", flag, RegistryValueKind.DWord);
}

  

如果绑定ProductCode.Engine许可,路径为\Software\ESRI\Engine10.2\ArcMap\Settings;如果绑定ProductCode.Desktop许可,路径为\Software\ESRI\ Desktop10.2\ArcMap\Settings

猜你喜欢

转载自www.cnblogs.com/liweis/p/10727496.html