带有Googple Map的Web浏览器 [英] Web Browser with Googple Map

查看:205
本文介绍了带有Googple Map的Web浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发桌面应用程序C#.Net。在我的表单中,我使用Web浏览器控件打开Goog​​le Map(使用API​​ 3.0)Google地图显示完美,但问题是公里数比例显示为空白。



我有一个脚本文件Map.html,如下所示:

 <!DOCTYPE HTML PUBLIC -  // W3C // DTD HTML 4.0 Transitional // EN> 
< html>
< head>

< title> Google地图< / title>
< script src =http://maps.google.com/maps/api/js?v=3&amp;sensor=false&libraries=geometrytype =text / javascript><<< ; /脚本>
< script type =text / javascript>
var map;
var markersArray = [];

window.onload = function()
{
var latlng = new google.maps.LatLng(29.99300,68.99414);
var options =
{
zoom:5,
center:latlng,
mapTypeId:google.maps.MapTypeId.ROADMAP,
scaleControl:true
};
map = new google.maps.Map(document.getElementById(divmap),options);
}

< / script>
< / head>

< body>
< div id =divmap>< / div>
< / body>
< / html>

和Visual Studio 2010中的一个窗体窗体。在窗体上,我放置了一个Web浏览器控件和窗体加载代码如下:

  private void Form1_Load(object sender,EventArgs e)
{
String strMapPath = @C:\WebBrowserWithGoogpleMap\Map.html;
webBrowser1.Navigate(new Uri(strMapPath));
}

请帮忙,如何摆脱这个问题。

解决方案

这个问题刚刚在另一个问题中得到解答。这似乎是事实,WPF WebBrowser使用旧版本的IE。



请参阅 scaleControl在.net中不能正确显示给出的答案


I am working on Desktop application C# .Net. On my form I am using Web Browser Control to open Google Map (Using API 3.0) Google map is showing perfectly but the problem is "Kilometer Scale" is showing blank.

I have a script file Map.html, showing below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>

<title>Google Maps</title>
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false&libraries=geometry" type="text/javascript"></script>
<script type="text/javascript">
var map;
var markersArray = [];

window.onload = function () 
{
    var latlng = new google.maps.LatLng(29.99300, 68.99414);
    var options = 
    {
        zoom: 5,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        scaleControl: true                
    };
    map = new google.maps.Map(document.getElementById("divmap"), options);
}

</script>    
</head>

<body>     
    <div id="divmap"></div>
</body>
</html>

and a windows form in Visual studio 2010. On form I have placed a Web Browser control and on form load code is given below:

private void Form1_Load(object sender, EventArgs e)
{
    String strMapPath = @"C:\WebBrowserWithGoogpleMap\Map.html";
    webBrowser1.Navigate(new Uri(strMapPath));
}

Please help, how to get rid from this problem.

解决方案

This issue has just been answered in another question. It seems to be the fact that WPF WebBrowser uses an old version of IE.

See scaleControl not displaying correctly in .net for the answer given there

这篇关于带有Googple Map的Web浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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