【问题标题】:Google Maps does not work in c# winforms谷歌地图在 c# winforms 中不起作用
【发布时间】:2015-10-10 12:42:34
【问题描述】:

我的 C# winforms 应用程序中的谷歌地图位置存在问题。

我总是收到这样的消息“您似乎在使用不受支持的浏览器。” 通过 Internet Explorer - 兼容性视图我删除了 google.it 和 google.com,但问题仍然存在。

我使用的代码如下:

private void Btn_Localizza_Click(object sender, EventArgs e)
{
   string street = txt_IndirizzoAZ.Text;
   string city = cbo_ComuneAZ.Text;
   string state = cbo_StatoAZ.Text;
   string zip = cbo_CapAZ.Text;


   try
   {
       StringBuilder add = new StringBuilder("http://maps.google.com/maps?q=");

       add.Append(street);
       add.Append(city);
       add.Append(state);
       add.Append(zip);
       webBrowser1.Navigate(add.ToString());


       if (street != string.Empty) {add.Append(street + "," + "+");}
       if (city != string.Empty) {add.Append(city + "," + "+");}
       if (state != string.Empty) {add.Append(state + "," + "+");}
       if (zip != string.Empty) { add.Append(zip + "," + "+"); }

       webBrowser1.Navigate(add.ToString());
   }
   catch (Exception ex)
   {
       MessageBox.Show(ex.Message + " Si è verificato un errore durante la geolocalizzazione dell'azienda." +
           " Contattare l'amministratore", "ERRORE", MessageBoxButtons.OK, MessageBoxIcon.Error);
   }

}

【问题讨论】:

    标签: c#


    【解决方案1】:

    也许changing the user agent string 是谷歌认为支持的东西?

    我确定嵌入对象正在从系统调用 Internet Explorer 来呈现它,因此考虑如果当前的 Windows IE 受 google 地图支持,那么您的应用程序也将支持或多或少是安全的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-15
      • 2015-01-31
      • 1970-01-01
      • 2017-06-12
      相关资源
      最近更新 更多