내지도에 문제가 있습니다. 지도는 약 5 개월 전에 올바르게 작동했습니다. 이제 내 좌표와 함께지도를로드 할 때지도가로드되지만지도를 탐색하고 확대 할 때 등지도와 연결이없는 것처럼 흰색 화면이 표시됩니다.지도를 다시로드해야하지만이 동일한 문제가 다시 발생합니다. . 약 5 개월 전이 스크립트를 사용하고 있었고 모든 것이 잘 작동했습니다. 탐색, 확대/축소,지도 유형 변경, 문제없이 모든 작업이 가능했습니다. 나는 구글 웹 사이트에 따르면 html 코드를 생성하고 새 리소스 파일에 넣어했습니다 내 버튼Google지도 Api 및 C#
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function load(latitude,longitude,zoomik) {
var myLatlng = new google.maps.LatLng(latitude,longitude);
var myOptions = {
zoom: zoomik,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Here!"});
}
</script>
</head>
<body onload="load()">
<div id="map_canvas"></div>
</body>
</html>
코드는 다음과 같습니다
private void TestButton_Click(object sender, EventArgs e)
{
webBrowser1.Document.InvokeScript("load", new object[] { -34.397, 150.644, 8 });
}
화면 : 지도가 제대로로드 :
팬 도구 또는 확대/축소 도구를 사용한 후 : - 흰색 화면이 비어 있습니다.
winforms의 Visual C# Express 및 WebBrowser 컨트롤을 사용하고 있습니다.
HTML 코드는 제대로 작동하지 않습니다 무엇 구글 API를 예제에서이 코드 더 (확인 작업 줌 및 팬)
을 (Aptana에 스튜디오를 사용하여) 파이어 폭스에서 제대로 작동 :
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
</body>
</html>
글쎄, 난 시각적으로 winforms에서 WebBrowser를 사용하고 있습니다. API 키? GoogleMaps API 웹 사이트에 따르면 : "이 버전의 Google Maps JavaScript API는 더 이상 API 키가 필요하지 않습니다!" Firefox에서 HTML 코드가 올바르게 작동했습니다. – Elfoc