You can do it even using dynamic maps,,
you will have to include a Browser Component in your project
and add a "OnLoaded Event"
private void webBrowser1_Loaded(object sender, RoutedEventArgs e)
{
Uri target = new Uri("GMaps.html", UriKind.Relative);
StreamResourceInfo sri = App.GetResourceStream(target);
StreamReader sr = new StreamReader(sri.Stream);
locmapString = sr.ReadToEnd();
webBrowser1.NavigateToString(locmapString);
}
the GMaps.html content is as described below and it's properties
should be included in the project as a Content Type and Copy Always
//##########################
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?
key=ABCDEFG"></script>
<script type="text/javascript">
google.load("maps", "2.x");
// Call this function when the page has been loaded
function initialize() {
// A TextualZoomControl is a GControl that displays textual
"Zoom In"
// and "Zoom Out" buttons (as opposed to the iconic buttons
used in
// Google Maps).
// We define the function first
function CustomZoomControl() {
}
// To "subclass" the GControl, we set the prototype object to
// an instance of the GControl object
CustomZoomControl.prototype = new GControl();
// Creates a one DIV for each of the buttons and places them
in a container
// DIV which is returned as our control element. We add the
control to
// to the map container and return the element for the map
class to
// position properly.
CustomZoomControl.prototype.initialize = function (map) {
var container = document.createElement("div");
// Zoom In Div
var zoomInDiv = document.getElementById("zoom_in");
GEvent.addDomListener(zoomInDiv, "click", function () {
map.zoomIn();
});
//Zoom out Div
var zoomOutDiv = document.getElementById("zoom_out");
GEvent.addDomListener(zoomOutDiv, "click", function () {
map.zoomOut();
});
//Pan Left Div
var panLeftDiv = document.getElementById("pan_lt");
GEvent.addDomListener(panLeftDiv, "click", function () {
map.panDirection(+1, 0)
});
//Pan Right Div
var panRightDiv = document.getElementById("pan_rt");
GEvent.addDomListener(panRightDiv, "click", function () {
map.panDirection(-1, 0)
});
//Pan Up Div
var panUpDiv = document.getElementById("pan_up");
GEvent.addDomListener(panUpDiv, "click", function () {
map.panDirection(0, +1)
});
//Pan Down Div
var panDownDiv = document.getElementById("pan_down");
GEvent.addDomListener(panDownDiv, "click", function () {
map.panDirection(0, -1)
});
//Pan Center Div
var panCenterDiv =
document.getElementById("center_result");
GEvent.addDomListener(panCenterDiv, "click", function () {
map.setCenter(new
google.maps.LatLng(24.71888611111111.22,46.79971944444444), 16);
});
map.getContainer().appendChild(container);
return container;
}
// By default, the control will appear in the top left corner
of the
// map with 7 pixels of padding.
CustomZoomControl.prototype.getDefaultPosition = function () {
return new GControlPosition(G_ANCHOR_TOP_LEFT, new
GSize(7, 7));
}
var map = new GMap2(document.getElementById("map"),
{ size: new GSize(1000, 700) });
map.setCenter(new
google.maps.LatLng(24.71888611111111,46.79971944444444), 16);
var point = new GLatLng(24.71888611111111,46.79971944444444);
var albiladMarkerIcon = new GIcon(G_DEFAULT_ICON);
albiladMarkerIcon.image = "http://www.someserver.com/images/
some_map_mark.gif";
albiladMarkerIcon.iconSize = new GSize(20, 20);
albiladMarkerIcon.shadowSize = new GSize(0, 0);
// Set up our GMarkerOptions object
markerOptions = { icon: albiladMarkerIcon };
//map.addControl(new GSmallMapControl());
map.addControl(new CustomZoomControl());
map.addOverlay(new GMarker(point, markerOptions));
}
google.setOnLoadCallback(initialize);
</script>
</head>
<body>
<div id="map"></div>
<div style="-webkit-user-select: none; z-index: 0; position: absolute;
left: 7px; top: 7px; overflow-x: hidden; overflow-y: hidden; text-
align: left; width: 200px; height: 150px; " class="gmnoprint">
<div style="position: absolute; left: 0px; top: 0px; width: 59px;
height: 62px; "><div style="width: 59px; height: 62px; overflow-x:
hidden; overflow-y: hidden; position: absolute; left: 0px; top: 0px;
">
<img style="position: absolute; left: 0px; top: 0px; -webkit-user-
select: none; border-top-width: 0px; border-right-width: 0px; border-
bottom-width: 0px; border-left-width: 0px; border-style: initial;
border-color: initial; padding-top: 0px; padding-right: 0px; padding-
bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; -webkit-user-drag: none; "
src="http://maps.gstatic.com/intl/en_ALL/mapfiles/mapcontrols2.png"></
div>
<div style="position: absolute; left: 20px; top: 0px; width: 18px;
height: 18px; cursor: pointer; " title="Pan up" id="pan_up"></div>
<div style="position: absolute; left: 0px; top: 20px; width: 18px;
height: 18px; cursor: pointer; " title="Pan left" id="pan_lt"></div>
<div style="position: absolute; left: 40px; top: 20px; width: 18px;
height: 18px; cursor: pointer; " title="Pan right" id="pan_rt"></div>
<div style="position: absolute; left: 20px; top: 40px; width: 18px;
height: 18px; cursor: pointer; " title="Pan down" id="pan_down"></div>
<div style="position: absolute; left: 20px; top: 20px; width: 18px;
height: 18px; cursor: pointer; " title="Return to the last result"
id="center_result">
</div></div>
<div style="width: 59px; overflow-x: hidden; overflow-y: hidden;
position: absolute; left: 0px; top: 62px; z-index: 1; height: 24px; ">
<div style="width: 59px; height: 292px; overflow-x: hidden; overflow-
y: hidden; ">
<img style="position: absolute; left: 0px; top: -62px; -webkit-user-
select: none; border-top-width: 0px; border-right-width: 0px; border-
bottom-width: 0px; border-left-width: 0px; border-style: initial;
border-color: initial; padding-top: 0px; padding-right: 0px; padding-
bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; -webkit-user-drag: none; "
src="http://maps.gstatic.com/intl/en_ALL/mapfiles/mapcontrols2.png"></
div>
<div id="zoom_in" style="position: absolute; left: 20px; top: 0px;
width: 18px; height: 18px; cursor: pointer; " title="Zoom In">
</div></div>
<div style="width: 59px; height: 30px; text-align: left; position:
absolute; left: 0px; top: 79px; ">
<div style="width: 59px; height: 30px; overflow-x: hidden; overflow-y:
hidden; position: absolute; ">
<img style="position: absolute; left: 0px; top: -354px; -webkit-user-
select: none; border-top-width: 0px; border-right-width: 0px; border-
bottom-width: 0px; border-left-width: 0px; border-style: initial;
border-color: initial; padding-top: 0px; padding-right: 0px; padding-
bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; -webkit-user-drag: none; "
src="http://maps.gstatic.com/intl/en_ALL/mapfiles/mapcontrols2.png"></
div>
<div id="zoom_out" style="position: absolute; left: 20px; top: 11px;
width: 18px; height: 18px; cursor: pointer; " title="Zoom Out">
</div></div>
<div style="position: absolute; left: 19px; top: 86px; width: 22px; z-
index: 2; cursor: pointer; visibility: hidden; height: 10px; ">
<div style="width: 22px; height: 14px; overflow-x: hidden; overflow-y:
hidden; cursor: url(http://maps.gstatic.com/intl/en_ALL/mapfiles/
openhand_8_8.cur), default; visibility: hidden; position: absolute;
left: 0px; top: 136px; " title="Drag to zoom"><img style="position:
absolute; left: 0px; top: -384px; -webkit-user-select: none; border-
top-width: 0px; border-right-width: 0px; border-bottom-width: 0px;
border-left-width: 0px; border-style: initial; border-color: initial;
padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-
left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;
margin-left: 0px; -webkit-user-drag: none; " src="http://
maps.gstatic.com/intl/en_ALL/mapfiles/mapcontrols2.png">
</div></div>
</div>
</body>
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.