AxMapPointControl

From MapElves

Jump to: navigation, search

Main page -> Help -> axMapPointControl

Contents

Overview

axMapPointControl is the ActiveX component to use embedded in GUI applications. It can be dropped on some visual control (for example a form) and the framework to have an embedded map is done.

Although it is possible to access the Application object from the MapPoint Control (for example, by using the Application property of the active Map object), doing so is not recommended. Instead, access equivalent Application functions —such as the Region property— directly from the MapPoint Control.

Properties

ActiveMap Get the currently open Map object.
ActivePrinter Get or set the active printer. There must be an open map.
Appearance Get or set the way that the border is drawn.
BorderStyle Get or set the border of the control.
Build Get the Microsoft MapPoint or MapPoint Control build number.
FullMapName Returns the path and name of the current map file.
ItineraryVisible Get or set whether the Directions pane is visible.
MousePointer Get or set the type of mouse pointer displayed when the mouse is hovered over the map.
PaneState Get or set the state of the pane on the MapPoint window.
ReadyState Returns whether the MapPoint Control is ready.
Region Returns the map region.
TabStop Get or set windows tab stop on the MapPoint Control.
Toolbars Returns the Toolbars collection.
Units Get or set the distance units.
Version Returns the Microsoft MapPoint or MapPoint Control version number.

Methods

CloseMap Closes the current map file.
NewMap Creates a new map.
OpenMap Opens an existing map.
SaveMap Saves the specified map or template.
SaveMapAs Saves the specified map or template.

Events

With the exception of the ReadyStateChange event, all events are a pass-through of the same event on the Map object. Do not display message or dialog boxes, pump messages or use lengthy code in any event handlers. See also Server busy pops up in the FAQ -> General.

AfterRedraw Occurs when MapPoint is finished repainting.
AfterViewChange Occurs when the view of the map has changed and the map is done repainting to that viewpoint.
BeforeClick Occurs after the user clicks on the map but before MapPoint has processed the action.
BeforeDblClick Occurs after the user double-clicks on the map but before MapPoint has processed the action.
DataMapChange Occurs after data mapping properties are changed for a data set.
MouseDown Occurs when a mouse button is pressed while the pointer is over the map.
MouseMove Occurs when the mouse is moved while the pointer is over the map.
MouseUp Occurs when a mouse button is released while the pointer is over the map.
NewDataSet Occurs after a new data set is created.
ReadyStateChange Occurs when the state of the MapPoint Control has changed.
RouteAfterCalculate Occurs after the route has been calculated.
RouteAfterOptimize Occurs after the stops on the route have been optimized.
SelectionChange Occurs when a selection on the map changes.

How to

Create the ActiveX component at runtime

Sometimes you need an extra hidden instance of MapPoint in your application for a while to do some temporary work. You can in some languages not mix the object model and the AcitveX model in same application (in C# that is the case). Solution is temporary create a hidden MapPoint control.

To create the component you need an owner. This owner can be any visible control, for example the main form. This is how to create in C#:

mp = new AxMapPoint.AxMappointControl();
owner.Controls.Add(mp);

Also don't forget to destroy it when you don't need it anymore. If you let this task be done by the garbage collector, it could take a lot of time to terminate your application and you need a lot of extra memory:

map.Saved = true;
owner.Controls.Remove(mp);
mp.Dispose();
Personal tools