如何在将Gogle地图合并到Windows窗体应用程序中时删除边栏? [英] How to remove sidebar while incorporating Gogle maps into a windows form app?

查看:80
本文介绍了如何在将Gogle地图合并到Windows窗体应用程序中时删除边栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建Windows窗体应用程序(使用C#的桌面应用程序),并且使用了Web浏览器控件来显示Google Maps网页.这是使用的代码.

StringBuilder queryAddress = new StringBuilder();
queryAddress.Append("http://maps.google.com/maps?q=");
webBrowser1.Navigate(queryAddress.ToString());

这将在Web浏览器控件中显示整个网页.有什么方法可以只显示地图?我不想在顶部看到侧边栏和Google搜索栏.

请帮忙.我在网上找不到任何代码.给出的所有代码仅适用于asp表单,不适用于桌面应用程序(即,它们使用javascript).

I''m building a windows form app (desktop app using C#) and i''ve used a web browser control to display the google maps web page. Here''s the code that is used.

StringBuilder queryAddress = new StringBuilder();
queryAddress.Append("http://maps.google.com/maps?q=");
webBrowser1.Navigate(queryAddress.ToString());

This shows the entire web page in the web browser control. Is there any way in which only the map can be shown? I don''t want to see the sidebar and the google search bar on top.

Please help. I''m not finding any code for this on the net. All codes given are only for asp forms and not for desktop apps (i.e. they use javascript)

推荐答案

对他们来说太复杂了谷歌地图站点上有文档,论坛和支持.从我使用它实际上已经有数年了,所以我不能直接回答您的问题,只能说我编写了一个完整的集成ASP.NET控件,该控件曾经用来在我选择的位置显示地图,以进行放大到正确的级别,以在地图上显示图钉等.我只是按照google网站上的教程进行操作,但我不记得有任何教程可以为您提供更多具体的信息.
This does sound like an example of a beginner starting with a task that is too complex for them. There''s documentation, forums and support at the google maps site. It''s literally years since I used it, so I can''t answer your questions directly except to say that I wrote a full integrated ASP.NET control that I used to show a map on a location I chose, to zoom in to the right level, to show pins on the map, etc. I just followed the tutorials on the google site, but I don''t recall any of it to give you any more specific info.


您必须创建自己的集成了地图的网页,然后浏览到该网页.然后它可以包含js.
You''d have to create your own web page that integrates a map, and browse to that. It can then contain js.


我已经完成了.现在我该如何与地图交谈?我的意思是,在原始代码中
queryAddress.Append("http://maps.google.com/maps?q=");
我使用的是一个名为"textcity"的文本框,用户必须在其中输入要显示的城市的名称,以及一个名为"btnMap"的按钮,单击该按钮时应显示相应的城市.以下代码对此进行了详细说明.
字符串city = string.Empty;
city = txtCity.Text.Replace('''',``+'');
queryAddress.Append(city +'',''+``+'');

仅当主地址为"http://maps.google.com/maps?q=.

但是现在,根据您的建议,我将google maps集成到网页"http://sraanishanth.awardspace.us"中.
但是对于这个地址,上面的方法不起作用.当我单击按钮时,资源管理器将引发404错误.请告诉我我该怎么办.
如果我的问题看起来太傻了,请原谅我,但是我所学的知识很少,直到现在我才开始学习.
I''ve done that. Now how do i talk to the map? What i mean is, in the original code
queryAddress.Append("http://maps.google.com/maps?q=");
i''m using a text box called "textcity" where the user has to enter the name of the city to be shown, and a button called "btnMap" upon whose click the respective city should be shown. The following code elaborates this.
string city = string.Empty;
city = txtCity.Text.Replace('' '', ''+'');
queryAddress.Append(city + '','' + ''+'');

This works only if the main address is "http://maps.google.com/maps?q=".

But now, on your advice, i''ve integrated google maps into a web page "http://sraanishanth.awardspace.us".
But for this address, the above method doesn''t work. When i click the buttton, the explorer throws a 404 error. Please tell me what i have to do.
Forgive me if my questions seem too silly, but i have little knowledge and only now i have started learning.


这篇关于如何在将Gogle地图合并到Windows窗体应用程序中时删除边栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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