|
Hope this is what your looking for. Just start a new windows project. Go to the toolbar on the left and right click. Make sure that your view is in design. With the right click menu group open you should see an option Add/Remove Items... Click on that option and a Customize Toolbox window should appear. Click on the COM components tap at the top. It should already be there but look for the Microsoft Mappoint Control 11.0 and put a check in the checkbox. If not click on the browse button and make your way to the Mappoint 2004 installation directory and find the MapointControl.ocx file. Click Ok when you done
Go back to your toolbox and scroll all the way down to the bottom. You should see the Mappoint control. Click on it and drag and drop the icon on the windows form.
You should know see the windows control window on the form and everything that you need to build a Mappoint windows app is not part of your project.
Private Sub LoadMappointControl()
Dim ienum As IEnumerator
Dim sStartupPath As String = Application.StartupPath
Try
m_oMap = mcMain.OpenMap(sStartupPath & "\MPSource.ptm")
m_oMap.AllowEdgePan = True
m_oMap.MapFont = MapPoint.GeoMapFont.geoMapFontSmaller
m_oApp = m_oMap.Application
'' HERE FOR FAIL SAFE. NEEED TO MAKE SURE THAT THE MP SOURCE FILE IS CLEAN OF ANY PREVIOUS DATA
'' REMOVE ANY AND ALL DATASETS BEFORE ADDING NEW ONES
If m_oMap.DataSets.Count > 0 Then
ienum = m_oMap.DataSets.GetEnumerator()
While ienum.MoveNext
DirectCast(ienum.Current, MapPoint.DataSet).Delete()
End While
End If
'' REMOVE ANY AND ALL SHAPES
If m_oMap.Shapes.Count > 0 Then
ienum = m_oMap.Shapes.GetEnumerator
While ienum.MoveNext
DirectCast(ienum.Current, MapPoint.Shape).Delete()
End While
End If
'' TURN OFF ALL POS (points of interests)
m_oMap.PlaceCategories.Visible = MapPoint.GeoTriState.geoFalse
'' CLEAR ACTIVE ROUTE CALCULATIONS
m_oMap.ActiveRoute.Clear()
m_frmSS.IncrementProgressBar(10)
' ************************************************** ***********************************************
'' LOAD CUSTOM SYMBOLS
For Each m_mpSymbol In m_oMap.Symbols
If m_mpSymbol.IsCustom Then
Select Case m_mpSymbol.Name
Case "GreenBldg"
m_mpGreenBuildingSymbol = m_mpSymbol
Case "RedBldg"
m_mpRedBuildingSymbol = m_mpSymbol
Case "Transparent"
m_mpTransparentSymbol = m_mpSymbol
End Select
End If
Next
'' LOAD PROPERTIES
m_dsMain.Tables.Add(LoadProperties())
m_frmSS.IncrementProgressBar(5)
'' LOAD PERSONNEL
m_dsMain.Tables.Add(LoadPersonnel())
m_frmSS.IncrementProgressBar(5)
'' DISPLAY PROPERTIES
DisplayProperties()
m_frmSS.IncrementProgressBar(5)
'' DISPLAY PERSONNEL
DisplayPersonnel()
m_frmSS.IncrementProgressBar(10)
Catch ex As Exception
Throw ex
End Try
End Sub |