Programmatically delete annotation

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
iansml
Posts: 31
Joined: Thu Apr 23, 2009 1:57 pm

Programmatically delete annotation

Post by iansml » Wed May 06, 2009 1:52 pm

Hi,

Is there any way I can programmatically remove an annotation? I am able to hide it using:

Code: Select all

imageViewer1.SelectedAnnotation.Visible = false;
but it is still present in the ImageViewer.Annotations collection. I want it to be removed completely (like when I select an annotation and delete it manually using the delete key).

Thanks

Alex
Site Admin
Posts: 1564
Joined: Thu Jul 10, 2008 2:21 pm

Re: Programmatically delete annotation

Post by Alex » Wed May 06, 2009 3:00 pm

Hi Ian,

Thank you for your message. You can use the Remove method of the AnnotationCollection class. Here is an example:

Code: Select all

AnnotationBase annoToRemove = annotationViewer1.Annotations[imageIndex][indexOfAnnoToRemove];
annotationViewer1.Annotations[imageIndex].RemoveAt(annoToRemove);
We will redefine the RemoveAt method of the AnnotationCollection class in next version of library and it will work correctly.

Best regards, Alexander

Post Reply