Document directory
Creating a clickable Map
- Insert a picturebox when using win forms or an <asp: imagebutton> for ASP. NET web forms.
- Set the image to your map-instance. ex.: myimage. Image = mymap. getmap ();
- Set up a click-event for your picturebox/imagebutton.
- Create a click-event handler, similar to the one below.
protected void imgMap_Click(object sender, ImageClickEventArgs e)
{ //Center the map on the click-point
myMap.Center = myMap.ImageToWorld(new System.Drawing.PointF(e.X, e.Y), myMap);
//Zoom in 2x
myMap.Zoom *= 0.5;
//Call function that renders the map and returns it to the client
myImage.Image = myMap.GetMap();}
Note: When Using ASP. net, you need to store the zoom and center values between requests. this can be done using either viewstate or session variables. these shoshould be restored on a PostBack, and stored when they are changed.