The drag and drop operation also creates and adds an instance of MapPoint control to your code file, as shown below:
private AxMapPoint.AxMappointControl axMappointControl1;
Before you use the AxMappointControl, you need to initialize the control by creating new map coverage. You do this by calling the NewMap method on the AxMappointControl class. This method takes the map region of type GeoMapRegion enumeration as an argument. There are two valid region values for the map region in MapPoint: GeoMapRegion.geoMapNorthAmerica for North American maps and GeoMapRegion.geoMapEurope for European maps.
The following code shows initializing the control to show the North American map:
axMappointControl1.NewMap(MapPoint.GeoMapRegion.geoMapNorthAmerica);
After initializing the map control, you can access the map object via the ActiveMap property, as shown below:
MapPoint.Map map = axMappointControl1.ActiveMap;
Once you have the map object, you can find and navigate to a specific location as shown below:
//Define a location instance
MapPoint.Location currentLocation = null;
//Get the current location from FindResults method
...
currentLocation = findResults.get_Item(ref index);
//Go to the current location on the map
currentLocation.GoTo();
Calling the GoTo method zooms in to the location with best possible view on the map and centers the map on that location.
To learn more about this topic and other related topics, please buy
Programming MapPoint in .NET
0 comments
Post a Comment