2015-10-10 22 views
0

我與谷歌地圖的位置的問題,在我的C#WinForms應用程序。谷歌地圖並不在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); 
    } 

}

回答

0

也許changing the user agent string的東西,谷歌認爲支持?

我敢肯定,嵌入的對象從系統調用Internet Explorer來呈現它,所以它可能是或多或少的安全考慮,如果當前的Windows IE瀏覽器是由谷歌地圖支持,然後您的應用程序也會。