其他方法如

System.Globalization.CultureInfo.InstalledUICulture.Name == "zh-CN"

不能获取。只有通过读注册表的方法成功了,备注一下。

国家/地区 代码意思  http://msdn.microsoft.com/en-us/library/ms912039.aspx

   private bool IsChina()
        {
            try
            {
                RegistryKey regkey = Registry.CurrentUser;
                RegistryKey regGeo = regkey.OpenSubKey(@"Control Panel\International\Geo", true);
                string sValue = regGeo.GetValue("Nation").ToString();
                if (regGeo.GetValue("Nation").ToString() == "45")
                {
                    regkey.Close();
                    regGeo.Close();
                    return true;
                }
                regkey.Close();
                regGeo.Close();

                return false;
            }
            catch
            {
                return false;
            }
        }

 

相关文章:

  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2021-08-29
猜你喜欢
  • 2022-12-23
  • 2021-11-25
  • 2021-04-12
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案