如何在WPF应用程序中加载Google地图? [英] How do I load Google maps in my WPF application?
问题描述
伙计们!我在我的应用程序中加载谷歌地图时遇到了麻烦。
我已尽我所能找到一条路,但没有任何效果。请帮忙!!!!!当我搜索某个位置时,我收到错误你正在使用不支持的浏览器,请更新为现代浏览器。
我使用的是Windows 10和VS 2010.我可以搜索谷歌上的任何内容但不能搜索地点(谷歌地图)
我尝试过:
我已经多次更新了我的Internet Explorer和chrome,但问题仍然存在。我也尝试将chrome设为我的默认浏览器,但它使用Internet Explorer搜索。 Bing Maps工作得非常好,但我已被指示使用谷歌地图。我该怎么办?迫切需要帮助........ Emelda
private void btnLocate_Click(object sender,RoutedEventArgs e)
{< br $>
string street = txt_Street.Text;
string surburb = txt_Surburb.Text;
string city = txt_City.Text;
string province = txt_Province.Text;
string country = txt_Country.Text;
string zipCode = txt_Zip.Text;
尝试
{
StringBuilder queryAddress = new StringBuilder();
queryAddress.Append(http:// www。 maps.google.com/maps?q=);
if(street!= string.Empty)
{
queryAddress.Append(街道+,++);
}
if(surburb!= string.Empty)
{
queryAddress.Append(surburb +,++);
}
if(city! = string.Empty)
{
queryAddress.Append(city +,++);
}
if(省!= string.Empty)
{
queryAddress.Append(省+,++ );
}
if(country!= string.Empty)
{
queryAddress.Append(country +,++);
}
if(zipCode!= string .Empty)
{
queryAddress.Append(zipCode +,++);
}
webBrowser1.Navigate(queryAddress.ToString());
这是背后的代码。
Hi, guys! i am having trouble with loading google maps in my application.
I have done everything in my power to find a way around but nothing has worked. Please Help!!!!! when ever i search for a location, i get the error"you are using an unsupported browser, please update to a modern one".
I am using windows 10 and VS 2010.I can search anything on google but not locations(google maps)
What I have tried:
I have updated both my internet explorer and chrome several times but the problem still persists. I have also tried to make chrome my default browser but it searches using internet explorer. Bing Maps work perfectly fine but i have been instructed to use google maps. What else should i do???? in dire need of help........Emelda
private void btnLocate_Click(object sender, RoutedEventArgs e)
{
string street = txt_Street.Text;
string surburb = txt_Surburb.Text;
string city = txt_City.Text;
string province = txt_Province.Text;
string country = txt_Country.Text;
string zipCode = txt_Zip.Text;
try
{
StringBuilder queryAddress = new StringBuilder();
queryAddress.Append("http://www.maps.google.com/maps?q=");
if (street != string.Empty)
{
queryAddress.Append(street + "," + "+");
}
if (surburb != string.Empty)
{
queryAddress.Append(surburb + "," + "+");
}
if (city != string.Empty)
{
queryAddress.Append(city + "," + "+");
}
if (province != string.Empty)
{
queryAddress.Append(province + "," + "+");
}
if (country != string.Empty)
{
queryAddress.Append(country + "," + "+");
}
if (zipCode != string.Empty)
{
queryAddress.Append(zipCode + "," + "+");
}
webBrowser1.Navigate(queryAddress.ToString());
this is the code behind.
阅读这个 [ ^ ]为什么你会看到这个以及如何处理它。
Read this[^] for why you're seeing this and what to do about it.
这篇关于如何在WPF应用程序中加载Google地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!