M Imran

M Imran

  • 1.7k
  • 5
  • 2.2k

Web Browser with Googple Map C# .Net Windows Application

May 9 2014 7:59 AM

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.

Thanks & Regards
MIA