Pages

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:

http://testdrive.mapinfo.com/techsupp/miprod.nsf/kbase_by_product/A5FA9134EB660E5A85256FB2005ABD17

http://community.mapinfo.com/forums/message.jspa?messageID=50295
http://testdrive.mapinfo.com/techsupp/miprod.nsf/kbase_by_product/A5FA9134EB660E5A85256FB2005ABD17
http://testdrive.mapinfo.com/techsupp/miprod.nsf/kbase_by_product/89C695CE5F2FAB4185256F0F005873BF

2 comments:

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.

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