Provides support for loading and saving objects to annotation files.
public class AnnCodecs Public Class AnnCodecs
public ref class AnnCodecs This class supports loading and saving annotation objects from and to disk files and to memory stream as well as getting information on information objects saved in a disk file or a memory stream.
This class also supports saving and loading multi-page annotation files or streams.
This example saves the objects from an existing container to a disk file and loads them back.
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Demos;using Leadtools.Help;public void AnnCodecs_AnnCodecs(string fileName){// 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);// create a new AnnCodecs classAnnCodecs codecs = new AnnCodecs();// save this container into a file// save the objects in this containercodecs.Save(fileName, container, AnnCodecsFormat.NativeXml, 1, AnnCodecsSavePageMode.Overwrite);// get information about the fileAnnCodecsInformation information = new AnnCodecsInformation();codecs.GetInformation(fileName, information);MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages));// save the objects again (as a second page)codecs.Save(fileName, container, AnnCodecsFormat.NativeXml, 2, AnnCodecsSavePageMode.Insert);// get information about the fileinformation = new AnnCodecsInformation();codecs.GetInformation(fileName, information);MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages));// delete the first pagecodecs.DeletePage(fileName, 1);// get information about the fileinformation = new AnnCodecsInformation();codecs.GetInformation(fileName, information);MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages));}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPublic Sub AnnCodecs_AnnCodecs(ByVal fileName As String)' 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.StrokeThickness = 1.0rectObj.Fill = Nothingcontainer.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)' create a new AnnCodecs classDim codecs As AnnCodecs = New AnnCodecs()' save this container into a file' save the objects in this containercodecs.Save(fileName, container, AnnCodecsFormat.NativeXml, 1, AnnCodecsSavePageMode.Overwrite)' get information about the fileDim information As AnnCodecsInformation = New AnnCodecsInformation()codecs.GetInformation(fileName, information)MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))' save the objects again (as a second page)codecs.Save(fileName, container, AnnCodecsFormat.NativeXml, 2, AnnCodecsSavePageMode.Insert)' get information about the fileinformation = New AnnCodecsInformation()codecs.GetInformation(fileName, information)MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))' delete the first pagecodecs.DeletePage(fileName, 1)' get information about the fileinformation = New AnnCodecsInformation()codecs.GetInformation(fileName, information)MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))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
