Counting the number of images captured or uploaded into an Image Annotation field is as simple as checking the Image Annotation field’s attachment length. Because of the audit-trail specialization of Mi-Forms, though, the count will not recognize if any images have been removed. To do this, a simple count for each attachment, that does not have the ‘RemovedUser’ property filled, is used.
In VB.Net, the image count can be obtained with the following script:
<MiCode(ControlScriptEventType.AfterInkAdded, "Hotspot")> _
Public Sub Ctl_Pen_AfterInkAdded(ByVal e As AfterInkAddedEventArgs)
Dim count = 0
For Each img As ImageData In _ImageAnnotation.ImageData
If img.RemovedUser = "" Then
The MsgBox at the end will deliver an updated image attachment count no matter how many, or if any were removed. In this case, the count is triggered by ink added in a Hotspot.
Me.RecordExportResult("Image Count:", True, count, "", count)