I found some VB.NET code that handles the ShapeIdentified event (as opposed to the ShapesIdentified). Interestingly, it appears that the IdentifiedShapes property is not in the documentation. I hope this helps.
Private Sub AxMap1_ShapeIdentified(sender As Object, e As AxMapWinGIS._DMapEvents_ShapeIdentifiedEvent) Handles AxMap1.ShapeIdentified
Dim shapes As SelectionList = AxMap1.IdentifiedShapes()
Dim desc As String
If shapes.Count > 0 Then
Dim sf As Shapefile = AxMap1.get_Shapefile(e.layerHandle)
Dim s As Shape = sf.Shape(e.shapeIndex)
If e.layerHandle = _RoadsLayerHandle Then
With sf
desc = String.Format("Roadname = {0}, FromID = {1}, ToID = {2}",
.CellValue(.FieldIndexByName("roadname"), e.shapeIndex),
.CellValue(.FieldIndexByName("FromID"), e.shapeIndex),
.CellValue(.FieldIndexByName("ToID"), e.shapeIndex))
End With
MsgBox(desc, , "Edge Description")
Else
MessageBox.Show(shapes.Count & " shapes identified" & vbCrLf &
AxMap1.get_LayerName(e.layerHandle) & ":" & e.shapeIndex, "AxMap1_ShapeIdentified")
End If
End If
End Sub
Sorry for the delayed response! I tried it with different ways and got it to work. Thank you for emphasize ShapeIdentified, not ShapesIdentified. The _DMapEvents_ShapesIdentifiedEvent does’t return the properties we need. _DMapEvents_ShapeIdentifiedEvent does. Which is the key. Thank you so much for the guidance!
See my code:
after InitializeComponent()
Add the function to delegate:
axMap1.ShapeIdentified += AxMap1ShapeIdentified;
void AxMap1ShapeIdentified(object sender, _DMapEvents_ShapeIdentifiedEvent e)
{
SelectionList shapes = axMap1.IdentifiedShapes;
if (shapes.Count > 0)
{
Shapefile sf = axMap1.get_Shapefile(e.layerHandle);
string s = "";
for (int i = 0; i < sf.NumFields; i++)
{
string val = sf.get_CellValue(i, e.shapeIndex).ToString();
if (val == "") val = "null";
s = sf.Table.Field[i].Name + ": " + val + ";\n ";
listBox1.Items.Add(s);
}
//MessageBox.Show(s, "Result");
}
}