Gets or sets the tag of this AnnObject.
public virtual int Tag { get; set; } Public Overridable Property Tag As Integer
And integer value that specifies the tag of this AnnObject.
The tag is an integer value that is not used by the LEADTOOLS Annotation toolkit. However, you can use the tag value to store any integer value you want. For example, you can use it store an index that links this AnnObject to other collections in your program.
This sample adds a tag to each AnnObject added to the container
using Leadtools;using Leadtools.Annotations;using Leadtools.Codecs;using Leadtools.WinForms;using Leadtools.Drawing;private int tagCount;public void AnnObject_Tag(){tagCount = 0;// create a container and subclass to its Objects.ItemAdded eventAnnContainer container = new AnnContainer();container.Objects.ItemAdded += new EventHandler<RasterCollectionEventArgs<AnnObject>>(AnObjectAddedToContainer);// add a few objects to the containerAnnLineObject lineObj = new AnnLineObject();container.Objects.Add(lineObj);AnnRectangleObject rectObj = new AnnRectangleObject();container.Objects.Add(rectObj);AnnEllipseObject ellipseObj = new AnnEllipseObject();container.Objects.Add(ellipseObj);// enumerate the objects in the container and show their tagforeach (AnnObject obj in container.Objects)MessageBox.Show(String.Format("Object type: {0}, Tag: {1}", obj.GetType().Name, obj.Tag));}private void AnObjectAddedToContainer(object sender, RasterCollectionEventArgs<AnnObject> e){// get the objectAnnObject obj = e.Item;// update its tagobj.Tag = tagCount;tagCount++;}
Imports LeadtoolsImports Leadtools.AnnotationsImports Leadtools.CodecsImports Leadtools.WinFormsImports Leadtools.DrawingPrivate tagCount As IntegerPublic Sub AnnObject_Tag()tagCount = 0' create a container and subclass to its Objects.ItemAdded eventDim container As AnnContainer = New AnnContainer()AddHandler container.Objects.ItemAdded, AddressOf AnObjectAddedToContainer' add a few objects to the containerDim lineObj As AnnLineObject = New AnnLineObject()container.Objects.Add(lineObj)Dim rectObj As AnnRectangleObject = New AnnRectangleObject()container.Objects.Add(rectObj)Dim ellipseObj As AnnEllipseObject = New AnnEllipseObject()container.Objects.Add(ellipseObj)' enumerate the objects in the container and show their tagFor Each obj As AnnObject In container.ObjectsMessageBox.Show(String.Format("Object type: {0}, Tag: {1}", obj.GetType().Name, obj.Tag))Next objEnd SubPrivate Sub AnObjectAddedToContainer(ByVal sender As Object, ByVal e As RasterCollectionEventArgs(Of AnnObject))' get the objectDim obj As AnnObject = e.Item' update its tagobj.Tag = tagCounttagCount += 1End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
