Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, March 5, 2009 4:42:21 PM(UTC)
yourfriend20030

Groups: Registered
Posts: 59


Hi
What must I do if I want to delete all annotation objects in a MedicalViewerCell before drawing a new annotation object so that there is only one annotation object in MedicalViewerCell at any time. For example, I draw a rectangle object on my Image. Then I draw a new rectangle object on this very image. But I want to see only one new rectangle but not two(the old existed rectangle before and the new I have drawn)
I have tried write code at AnnotationCreated Event of MedicalViewer like that
void _medicalViewer_AnnotationCreated(object sender, MedicalViewerAnnotationCreatedEventArgs e)
{
Leadtools.Annotations.AnnContainer AnnContainer;
AnnContainer = _medicalViewer.Cells[CellIndex].GetAnnotationContainer();
AnnContainer.Objects.Clear();
_medicalViewer.Cells[CellIndex].Invalidate();
_medicalViewer.Invalidate();
_medicalViewer.Update();

}
But after this event, All object is not cleared from my Image
Can you help me to remain only new drawn annotation object on my Image
Thanks in advance!
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, March 9, 2009 11:23:05 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

How many cells do you have?  If you have more than 1 cell, try calling GetAnnotationContainer(cellIndex) and then clearing the container.  By the way, what version of the toolkit are you using?
 
#3 Posted : Monday, March 9, 2009 10:41:44 PM(UTC)
yourfriend20030

Groups: Registered
Posts: 59


I have only one cell. and I have tried to GetAnnotationContainer(cellIndex) to get AnnContainer. But as I said, After I use Method Clear() of AnnContainer Object. All Ann Objects did not disappear from my Image.
That's my problem. Please Help me to solve this as soon as possible
Thanks in advance!
 
#4 Posted : Friday, March 13, 2009 4:05:26 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I'm currently checking on this with some of the other agents here.  But as a work around I was able to empty the container by passing in an empty one like this:  medicalViewer1.Cells[0].SetAnnotationContainer(new AnnContainer());
 
#5 Posted : Sunday, March 15, 2009 4:30:44 PM(UTC)
yourfriend20030

Groups: Registered
Posts: 59


Thanks
I applied your hint and solved this problem well
Thanks again and have a nice day!
 
#6 Posted : Monday, March 16, 2009 4:55:15 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Just to confirm the solution, the GetAnnotationContainer() returns a copy of the annotation container.  It does not return a reference to the annotation container object.  So the above solution of passing in an empty container is correct.  If you wanted to only modify/add objects to the annotation container you would do that with the container returned by GetAnnotationContainer().  Then you set that container back with SetAnnotationContainer.  Like this:

AnnContainer tempContainer = medicalViewer.Cells[0].GetAnnotationContainer();
tempContainer.Objects.Add(someAnnotationObject);  // add my annotation object
medicalViewer.Cells[0].SetAnnotationContainer(tempContainer);

 
#7 Posted : Tuesday, August 31, 2010 1:20:16 AM(UTC)
yourfriend20030

Groups: Registered
Posts: 59


Thanks so much :)
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.073 seconds.