ObjectsFromPoint method
Returns a collection of locations and Pushpins (FindResults collection) corresponding to what would be selected or what appears in the Select a Place dialog box for particular screen coordinates at the current elevation. Returns an error if the coordinates are not in the map window.
Applies to
Objects: Map
Syntax
object.ObjectsFromPoint(X, Y)
Parameters
Part | Description |
---|---|
object | Required. An expression that returns a Map object. |
X | Required Long. The X coordinate of the desired location on the screen, in pixels. |
Y | Required Long. The Y coordinate of the desired location on the screen, in pixels. |
Remarks
The locations returned by the ObjectsFromPoint method depends on the elevation of the current map view. The closer in the map view, the more detailed the locations returned. For example, if the map view is zoomed in, the locations may be street addresses, where if it is zoomed out, the locations may be large geographic areas.
Example
Dim WithEvents objApp As MapPoint.Application
Dim WithEvents objMap As MapPoint.Map
Private Sub Form_Load()
'Set up the application
Set objApp = CreateObject("mappoint.application")
Set objMap = objApp.ActiveMap
objApp.Visible = True
objApp.UserControl = True
End Sub
Private Sub objMap_BeforeClick(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long, Cancel As Boolean)
Dim objResults As MapPoint.FindResults
Dim objResult As Object
'Display the name of each object where user clicks on map
Set objResults = objMap.ObjectsFromPoint(X, Y)
For Each objResult In objResults
MsgBox objResult.Name
Next
End Sub