Google地图无法在c#Winforms中使用 [英] Google Maps does not work in c# Winforms

查看:114
本文介绍了Google地图无法在c#Winforms中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我的应用程序Winforms中的谷歌地图有问题c#

我总是收到此消息您似乎使用的是不受支持的浏览器。

通过Internet Explorer - 兼容性视图我删除了google.it和google.com但问题仍然存在。

我使用的代码如下:



Hello,
I have a problem with the location of google maps in my Apllication Winforms c#
I get always this message "You seem to be using an unsupported browser."
By Internet explorer - Compatibility View I removed google.it and google.com but the problem persists.
The code I used is as follows:

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);
           }
       }

推荐答案

默认情况下,webbroswer控件采用较低版本的IE(可能为7)。

Google地图可能无法在IE 7上运行。



尝试通过更改注册表项中的值来使用更高版本。

配置Internet Explorer的仿真模式Web浏览器控件 [ ^ ]通过代码提供修复。



或者,您可以手动更改注册表设置。
The webbroswer control by default takes a lower version of IE (possibly 7).
Google maps will probably not work on IE 7.

Try using a later version by changing the value in the registry key.
Configuring the emulation mode of an Internet Explorer WebBrowser control[^] provides a fix through code.

Alternately, you can go and change the registry setting manually.


这篇关于Google地图无法在c#Winforms中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆