C#
VB
C++
Represents an ordered collection of AnnObject.
public sealed class AnnObjectCollection : ObservableCollection<AnnObject> Public NotInheritable Class AnnObjectCollectionInherits System.Collections.ObjectModel.ObservableCollection(Of AnnObject)Implements System.Collections.Generic.ICollection(Of AnnObject), System.Collections.Generic.IEnumerable(Of AnnObject), System.Collections.Generic.IList(Of AnnObject), System.Collections.Generic.IReadOnlyCollection(Of AnnObject), System.Collections.Generic.IReadOnlyList(Of AnnObject), System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Collections.Specialized.INotifyCollectionChanged, System.ComponentModel.INotifyPropertyChanged
public ref class AnnObjectCollection sealed : public System.Collections.ObjectModel.ObservableCollection<AnnObject>, System.Collections.Generic.ICollection<AnnObject>, System.Collections.Generic.IEnumerable<AnnObject>, System.Collections.Generic.IList<AnnObject>, System.Collections.Generic.IReadOnlyCollection<AnnObject>, System.Collections.Generic.IReadOnlyList<AnnObject>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Collections.Specialized.INotifyCollectionChanged, System.ComponentModel.INotifyPropertyChanged
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Demos;using Leadtools.Help;public void AnnObjectCollectionExample(AnnContainer container){container.ObjectAdded += new EventHandler<AnnObjectCollectionEventArgs>(container_ObjectAdded);container.ObjectRemoved += new EventHandler<AnnObjectCollectionEventArgs>(container_ObjectRemoved);// add a few objectsAnnLineObject lineObj = new AnnLineObject();lineObj.Start = new Point(100, 100);lineObj.End = new Point(200, 200);lineObj.Stroke = Colors.Blue;lineObj.StrokeThickness = 2.0;lineObj.Header = "Object 1";AnnRectangleObject rectObj = new AnnRectangleObject();rectObj.Rect = new Rect(200, 200, 100, 100);rectObj.Stroke = Colors.Blue;rectObj.Fill = Colors.Transparent;rectObj.StrokeThickness = 2.0;rectObj.Header = "Object 2";AnnEllipseObject ellipseObj = new AnnEllipseObject();ellipseObj.Rect = new Rect(200, 200, 150, 100);ellipseObj.Stroke = Colors.Yellow;ellipseObj.Fill = Colors.Green;ellipseObj.StrokeThickness = 2.0;ellipseObj.Header = "Object 3";container.Children.Add(lineObj);container.Children.Add(rectObj);container.Children.Add(ellipseObj);// insert new ObjectAnnLineObject newLineObj = lineObj.Clone() as AnnLineObject;newLineObj.Start = new Point(110, 110);newLineObj.End = new Point(210, 210);newLineObj.Stroke = Colors.Red;newLineObj.StrokeThickness = 2.0;newLineObj.Header = "New Object";container.Children.Insert(1, newLineObj);// check if collection contains this new itemSystem.Diagnostics.Debug.Assert(container.Children.Contains(newLineObj));// remove this new itemcontainer.Children.Remove(newLineObj);System.Diagnostics.Debug.Assert(!container.Children.Contains(newLineObj));// remove the last itemcontainer.Children.RemoveAt(container.Children.Count - 1);System.Diagnostics.Debug.Assert(container.Children.Count == 2);// send the first item to the end of the collectioncontainer.Children.SendToBack(lineObj, true);System.Diagnostics.Debug.Assert(container.Children.IndexOf(lineObj) == container.Children.Count - 1);// bring it back to the frontcontainer.Children.BringToFront(lineObj, true);System.Diagnostics.Debug.Assert(container.Children.IndexOf(lineObj) == 0);// clean the collectioncontainer.Children.Clear();System.Diagnostics.Debug.Assert(container.Children.Count == 0);}private void container_ObjectAdded(object sender, AnnObjectCollectionEventArgs e){Console.WriteLine("The Object ((" + e.Object.Header + ")) Has been added to the collection");}private void container_ObjectRemoved(System.Object sender, AnnObjectCollectionEventArgs e){Console.WriteLine("The Object ((" + e.Object.Header + ")) Has been removed from the collection");}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPublic Sub AnnObjectCollectionExample(ByVal container As AnnContainer)AddHandler container.ObjectAdded, AddressOf container_ObjectAddedAddHandler container.ObjectRemoved, AddressOf container_ObjectRemoved' add a few objectsDim lineObj As AnnLineObject = New AnnLineObject()lineObj.Start = New Point(100, 100)lineObj.End = New Point(200, 200)lineObj.Stroke = Colors.BluelineObj.StrokeThickness = 2.0lineObj.Header = "Object 1"Dim rectObj As AnnRectangleObject = New AnnRectangleObject()rectObj.Rect = New Rect(200, 200, 100, 100)rectObj.Stroke = Colors.BluerectObj.StrokeThickness = 2.0rectObj.Fill = Colors.TransparentrectObj.Header = "Object 2"Dim ellipseObj As AnnEllipseObject = New AnnEllipseObject()ellipseObj.Rect = New Rect(200, 200, 150, 100)ellipseObj.Stroke = Colors.YellowellipseObj.StrokeThickness = 2.0ellipseObj.Fill = Colors.GreenellipseObj.Header = "Object 3"container.Children.Add(lineObj)container.Children.Add(rectObj)container.Children.Add(ellipseObj)' insert new ObjectDim newLineObj As AnnLineObject = DirectCast(lineObj.Clone(), AnnLineObject)newLineObj.Start = New Point(110, 110)newLineObj.End = New Point(210, 210)newLineObj.Stroke = Colors.RednewLineObj.StrokeThickness = 2.0newLineObj.Header = "New Object"container.Children.Insert(1, newLineObj)' check if collection contains this new itemSystem.Diagnostics.Debug.Assert(container.Children.Contains(newLineObj))' remove this new itemcontainer.Children.Remove(newLineObj)System.Diagnostics.Debug.Assert((Not container.Children.Contains(newLineObj)))' remove the last itemcontainer.Children.RemoveAt(container.Children.Count - 1)System.Diagnostics.Debug.Assert(container.Children.Count = 2)' send the first item to the end of the collectioncontainer.Children.SendToBack(lineObj, True)System.Diagnostics.Debug.Assert(container.Children.IndexOf(lineObj) = container.Children.Count - 1)' bring it back to the frontcontainer.Children.BringToFront(lineObj, True)System.Diagnostics.Debug.Assert(container.Children.IndexOf(lineObj) = 0)' clean the collectioncontainer.Children.Clear()System.Diagnostics.Debug.Assert(container.Children.Count = 0)End SubPrivate Sub container_ObjectAdded(ByVal sender As Object, ByVal e As AnnObjectCollectionEventArgs)Console.WriteLine("The Object ((" & e.Object.Header & ")) Has been added to the collection")End SubPrivate Sub container_ObjectRemoved(ByVal sender As System.Object, ByVal e As AnnObjectCollectionEventArgs)Console.WriteLine("The Object ((" & e.Object.Header & ")) Has been removed from the collection")End Sub
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Examples;//using Leadtools.Help;public void AnnObjectCollectionExample(AnnContainer container){container.ObjectAdded += new EventHandler<AnnObjectCollectionEventArgs>(container_ObjectAdded);container.ObjectRemoved += new EventHandler<AnnObjectCollectionEventArgs>(container_ObjectRemoved);// add a few objectsAnnLineObject lineObj = new AnnLineObject();lineObj.Start = new Point(100, 100);lineObj.End = new Point(200, 200);lineObj.Stroke = Colors.Blue;lineObj.StrokeThickness = 2.0;lineObj.Header = "Object 1";AnnRectangleObject rectObj = new AnnRectangleObject();rectObj.Rect = new Rect(200, 200, 100, 100);rectObj.Stroke = Colors.Blue;rectObj.Fill = Colors.Transparent;rectObj.StrokeThickness = 2.0;rectObj.Header = "Object 2";AnnEllipseObject ellipseObj = new AnnEllipseObject();ellipseObj.Rect = new Rect(200, 200, 150, 100);ellipseObj.Stroke = Colors.Yellow;ellipseObj.Fill = Colors.Green;ellipseObj.StrokeThickness = 2.0;ellipseObj.Header = "Object 3";container.Children.Add(lineObj);container.Children.Add(rectObj);container.Children.Add(ellipseObj);// insert new ObjectAnnLineObject newLineObj = lineObj.Clone() as AnnLineObject;newLineObj.Start = new Point(110, 110);newLineObj.End = new Point(210, 210);newLineObj.Stroke = Colors.Red;newLineObj.StrokeThickness = 2.0;newLineObj.Header = "New Object";container.Children.Insert(1, newLineObj);// check if collection contains this new itemSystem.Diagnostics.Debug.Assert(container.Children.Contains(newLineObj));// remove this new itemcontainer.Children.Remove(newLineObj);System.Diagnostics.Debug.Assert(!container.Children.Contains(newLineObj));// remove the last itemcontainer.Children.RemoveAt(container.Children.Count - 1);System.Diagnostics.Debug.Assert(container.Children.Count == 2);// send the first item to the end of the collectioncontainer.Children.SendToBack(lineObj, true);System.Diagnostics.Debug.Assert(container.Children.IndexOf(lineObj) == container.Children.Count - 1);// bring it back to the frontcontainer.Children.BringToFront(lineObj, true);System.Diagnostics.Debug.Assert(container.Children.IndexOf(lineObj) == 0);// clean the collectioncontainer.Children.Clear();System.Diagnostics.Debug.Assert(container.Children.Count == 0);}private void container_ObjectAdded(object sender, AnnObjectCollectionEventArgs e){Console.WriteLine("The Object ((" + e.Object.Header + ")) Has been added to the collection");}private void container_ObjectRemoved(System.Object sender, AnnObjectCollectionEventArgs e){Console.WriteLine("The Object ((" + e.Object.Header + ")) Has been removed from the collection");}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPublic Sub AnnObjectCollectionExample(ByVal container As AnnContainer)AddHandler container.ObjectAdded, AddressOf container_ObjectAddedAddHandler container.ObjectRemoved, AddressOf container_ObjectRemoved' add a few objectsDim lineObj As AnnLineObject = New AnnLineObject()lineObj.Start = New Point(100, 100)lineObj.End = New Point(200, 200)lineObj.Stroke = Colors.BluelineObj.StrokeThickness = 2.0lineObj.Header = "Object 1"Dim rectObj As AnnRectangleObject = New AnnRectangleObject()rectObj.Rect = New Rect(200, 200, 100, 100)rectObj.Stroke = Colors.BluerectObj.Fill = Colors.TransparentrectObj.StrokeThickness = 2.0rectObj.Header = "Object 2"Dim ellipseObj As AnnEllipseObject = New AnnEllipseObject()ellipseObj.Rect = New Rect(200, 200, 150, 100)ellipseObj.Stroke = Colors.YellowellipseObj.Fill = Colors.GreenellipseObj.StrokeThickness = 2.0ellipseObj.Header = "Object 3"container.Children.Add(lineObj)container.Children.Add(rectObj)container.Children.Add(ellipseObj)' insert new ObjectDim newLineObj As AnnLineObject = TryCast(lineObj.Clone(), AnnLineObject)newLineObj.Start = New Point(110, 110)newLineObj.End = New Point(210, 210)newLineObj.Stroke = Colors.RednewLineObj.StrokeThickness = 2.0newLineObj.Header = "New Object"container.Children.Insert(1, newLineObj)' check if collection contains this new itemSystem.Diagnostics.Debug.Assert(container.Children.Contains(newLineObj))' remove this new itemcontainer.Children.Remove(newLineObj)System.Diagnostics.Debug.Assert((Not container.Children.Contains(newLineObj)))' remove the last itemcontainer.Children.RemoveAt(container.Children.Count - 1)System.Diagnostics.Debug.Assert(container.Children.Count = 2)' send the first item to the end of the collectioncontainer.Children.SendToBack(lineObj, True)System.Diagnostics.Debug.Assert(container.Children.IndexOf(lineObj) = container.Children.Count - 1)' bring it back to the frontcontainer.Children.BringToFront(lineObj, True)System.Diagnostics.Debug.Assert(container.Children.IndexOf(lineObj) = 0)' clean the collectioncontainer.Children.Clear()System.Diagnostics.Debug.Assert(container.Children.Count = 0)End SubPrivate Sub container_ObjectAdded(ByVal sender As Object, ByVal e As AnnObjectCollectionEventArgs)Console.WriteLine("The Object ((" & e.Object.Header & ")) Has been added to the collection")End SubPrivate Sub container_ObjectRemoved(ByVal sender As System.Object, ByVal e As AnnObjectCollectionEventArgs)Console.WriteLine("The Object ((" & e.Object.Header & ")) Has been removed from the collection")End 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
