Apr 14, 2009

how to display map co-ordinates for the mouse position + Mapextreme

          1. Add this line to public MapForm1():
mapControl1.MouseMove += new MouseEventHandler(MapControl1_MouseMove);
          2. Add this function to the project:
public void MapControl1_MouseMove(object sender, MouseEventArgs e)
System.Drawing.PointF DisplayPoint = new PointF(e.X,e.Y);
MapInfo.Geometry.DPoint MapPoint = new MapInfo.Geometry.DPoint();

MapInfo.Geometry.DisplayTransform converter = this.mapControl1.Map.DisplayTransform;
converter.FromDisplay(DisplayPoint, out MapPoint);

this.statusBar1.Text = "Cursor Location: " + MapPoint.x.ToString() + ", " + MapPoint.y.ToString();

This will display the current coordinates of the mouse position.

useful links for custom selection tools:


Anurag said...

Hi Mukund can you provide code for Popup when we move mouse over map

Mukund The Lion said...

You can all the javscript code from the above method to show the data in the popup.

ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Key", "showXY(x,y);", true);