Dvonrick
04-25-2008, 02:59 PM
I have no problem taking a user entered (or GPS) lat/lon and putting a pushpin on a map. What I need to do now is allow the user to click a point on the map and have my program pickup the location of that point. Seems like this should be easy I just can't find the right method/property. Clicking on the map puts a location circle on the map but I don't think that is a pushpin, not sure what it is so don't know how to grab it. Thanks.
Mattys Consulting
04-26-2008, 08:45 PM
Hi Dvonrick,
I'm sure Wilfried will be along any time now to speak C#,
but basically you just want the x and y coordinates of
the mouse ... :50w: ... and make a call to map.xytolocation.
Mike Mattys
Wilfried
04-28-2008, 04:14 AM
Hi,
Yes as Mike say you have to write a BeforeClick event handler. There you have the x,y coordinates. to have a location from it:
Location loc = MP.ActiveMap.XYToLocation(e.x, e.y);
MP is the mappoint control in this case.
Dvonrick
04-28-2008, 01:50 PM
Thanks. And just to make sure I am not missing something, I will need to do the calculations to go from x/y to Lat/Lon. There is no property I can grab/method I can call?
Thanks again.
Mattys Consulting
04-28-2008, 02:42 PM
Dvonrick,
As soon as you do this:
Location loc = MP.ActiveMap.XYToLocation(e.x, e.y);
loc will aquire the properties:
loc.latitude
loc.longitude
:39v:
(In MapPoint v2006)
Mike Mattys
Wilfried
04-28-2008, 03:15 PM
Hey Mike,
We all really are a team. I like that :)
Mattys Consulting
04-28-2008, 04:41 PM
Hi Wilfried - Yep! Me, too! :50v:
Mattys Consulting
04-28-2008, 09:58 PM
Well ...
I doubt that smilie would ever have gotten used anyway. :dunce:
Mike Mattys
Dvonrick
04-29-2008, 01:06 PM
Thanks. I had just received Mappoint 2006 and had not yet installed it prior to my last question. This makes it easier. I've done way too much low level coding in my life and am getting up to speed with some of this.
Thanks again.