Saves the annotation objects to a stream.
public static void Save(Stream stream,Leadtools.Windows.Annotations.AnnContainer container)
Public Overloads Shared Sub Save( _ByVal stream As Stream, _ByVal container As Leadtools.Windows.Annotations.AnnContainer _)
public:static void Save(Stream^ stream,Leadtools.Windows.Annotations.AnnContainer^ container)
stream
The stream to which to save the objects.
container
An AnnContainer containing the objects to be saved.
This method will save the annotations to the stream using the AnnCodecsFormat.NativeXml format.
This method will not position the stream back to its original position before it returns. It is your responsibility to position the stream back before you can load objects from this stream.
For more information, refer to WPF Annotation Files.
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPublic Sub AnnCodecs_LoadSaveContainer()' create a new annotation containerDim container As New AnnContainer()' add a few objects into the containerDim rectObj As New AnnRectangleObject()rectObj.Rect = New Rect(100, 100, 100, 100)rectObj.Stroke = Colors.BluerectObj.Fill = Colors.TransparentrectObj.StrokeThickness = 1.0container.Children.Add(rectObj)Dim lineObj As New AnnLineObject()lineObj.Start = New Point(100, 100)lineObj.End = New Point(200, 200)lineObj.Stroke = Colors.RedlineObj.StrokeThickness = 1.0container.Children.Add(lineObj)MessageBox.Show(String.Format("Before Save: Container has {0} objects", container.Children.Count))' create a memory stream to save the objects intoUsing ms As New MemoryStream()' save the objects in this containerAnnCodecs.Save(ms, container)ms.Position = 0' clear the containercontainer.Children.Clear()MessageBox.Show(String.Format("After Save and Clear: Container has {0} objects, Stream size: {1}", container.Children.Count, ms.Length))' load the objects back from the streamAnnCodecs.Load(ms, container)MessageBox.Show(String.Format("After Load: Container has {0} objects", container.Children.Count))End UsingEnd Sub
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Demos;using Leadtools.Help;public void AnnCodecs_LoadSaveContainer(){// create a new annotation containerAnnContainer container = new AnnContainer();// add a few objects into the containerAnnRectangleObject rectObj = new AnnRectangleObject();rectObj.Rect = new Rect(100, 100, 100, 100);rectObj.Stroke = Colors.Blue;rectObj.Fill = Colors.Transparent;rectObj.StrokeThickness = 1.0;container.Children.Add(rectObj);AnnLineObject lineObj = new AnnLineObject();lineObj.Start = new Point(100, 100);lineObj.End = new Point(200, 200);lineObj.Stroke = Colors.Red;lineObj.StrokeThickness = 1.0;container.Children.Add(lineObj);MessageBox.Show(string.Format("Before Save: Container has {0} objects", container.Children.Count));// create a memory stream to save the objects intousing(MemoryStream ms = new MemoryStream()){// save the objects in this containerAnnCodecs.Save(ms, container);ms.Position = 0;// clear the containercontainer.Children.Clear();MessageBox.Show(string.Format("After Save and Clear: Container has {0} objects, Stream size: {1}", container.Children.Count, ms.Length));// load the objects back from the streamAnnCodecs.Load(ms, container);MessageBox.Show(String.Format("After Load: Container has {0} objects", container.Children.Count));}}
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Examples;public void AnnCodecs_LoadSaveContainer(){// create a new annotation containerAnnContainer container = new AnnContainer();// add a few objects into the containerAnnRectangleObject rectObj = new AnnRectangleObject();rectObj.Rect = new Rect(100, 100, 100, 100);rectObj.Stroke = Colors.Blue;rectObj.Fill = Colors.Transparent;rectObj.StrokeThickness = 1.0;container.Children.Add(rectObj);AnnLineObject lineObj = new AnnLineObject();lineObj.Start = new Point(100, 100);lineObj.End = new Point(200, 200);lineObj.Stroke = Colors.Red;lineObj.StrokeThickness = 1.0;container.Children.Add(lineObj);MessageBox.Show(string.Format("Before Save: Container has {0} objects", container.Children.Count));// create a memory stream to save the objects intousing(MemoryStream ms = new MemoryStream()){// save the objects in this containerAnnCodecs.Save(ms, container);ms.Position = 0;// clear the containercontainer.Children.Clear();MessageBox.Show(string.Format("After Save and Clear: Container has {0} objects, Stream size: {1}", container.Children.Count, ms.Length));// load the objects back from the streamAnnCodecs.Load(ms, container);MessageBox.Show(String.Format("After Load: Container has {0} objects", container.Children.Count));}}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPublic Sub AnnCodecs_LoadSaveContainer()' create a new annotation containerDim container As AnnContainer = New AnnContainer()' add a few objects into the containerDim rectObj As AnnRectangleObject = New AnnRectangleObject()rectObj.Rect = New Rect(100, 100, 100, 100)rectObj.Stroke = Colors.BluerectObj.Fill = Colors.TransparentrectObj.StrokeThickness = 1.0container.Children.Add(rectObj)Dim lineObj As AnnLineObject = New AnnLineObject()lineObj.Start = New Point(100, 100)lineObj.End = New Point(200, 200)lineObj.Stroke = Colors.RedlineObj.StrokeThickness = 1.0container.Children.Add(lineObj)MessageBox.Show(String.Format("Before Save: Container has {0} objects", container.Children.Count))' create a memory stream to save the objects intoUsing ms As MemoryStream = New MemoryStream()' save the objects in this containerAnnCodecs.Save(ms, container)ms.Position = 0' clear the containercontainer.Children.Clear()MessageBox.Show(String.Format("After Save and Clear: Container has {0} objects, Stream size: {1}", container.Children.Count, ms.Length))' load the objects back from the streamAnnCodecs.Load(ms, container)MessageBox.Show(String.Format("After Load: Container has {0} objects", container.Children.Count))End UsingEnd Sub
|
Products |
Support |
Feedback: Save(Stream,AnnContainer) Method - Leadtools.Windows.Annotations |
Introduction |
Help Version 19.0.2017.3.22
|

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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.