Here is a code sample for VB.NET:
Code: Select all
Dim images As ImageCollection = new ImageCollection()
Dim annotations As AnnotationController = new AnnotationController(images)
images.Add("TiffWithAnnotations.tiff")
Dim imageIndex As Integer, annoIndex As Integer
For imageIndex = 0 To images.Count - 1
Dim imageAnnotations As AnnotationCollection = annotations(imageIndex)
For annoIndex = 0 To imageAnnotations.Count - 1
Dim textAnno As TextAnnotation = CType(imageAnnotations(annoIndex), TextAnnotation)
If textAnno.GetType() Is GetType(TextAnnotation) Then
If textAnno.Text = "MySearchString"
MsgBox "Annotation 'MySearchString' is found!"
End If
End If
Next annoIndex
Next imageIndex
Code: Select all
ImageCollection images = new ImageCollection();
AnnotationController annotations = new AnnotationController(images);
images.Add("TiffWithAnnotations.tiff");
for (int imageIndex = 0; imageIndex < images.Count; imageIndex++)
{
AnnotationCollection imageAnnotations = annotations[imageIndex];
for (int annoIndex = 0; annoIndex < imageAnnotations.Count; annoIndex++)
{
TextAnnotation textAnno = imageAnnotations[annoIndex] As TextAnnotation;
if (textAnno != null)
{
if (textAnno.Text == "MySearchString")
{
MessageBox.Show("Annotation 'MySearchString' is found!");
}
}
}
}