←Select platform

DeletePage(string,int) Method

Summary

Deletes a page from an annotation file containing multiple pages.

Syntax

C#
VB
C++
public void DeletePage( 
   string fileName, 
   int page 
) 
  
Public Overloads Sub DeletePage( _ 
   ByVal fileName As String, _ 
   ByVal page As Integer _ 
)  
public: 
void DeletePage(  
   String^ fileName, 
   int page 
)  

Parameters

fileName
Name of the annotation file.

page
Number of the page to be deleted. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.

Remarks

This method can be used to remove annotation pages from a multi-page annotation file. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, and so on. This method can be used for all LEAD annotation file formats. To determine the format for a particular LEAD annotation file, use GetInformation(string,anncodecsinformation).

Note, you cannot delete a page from an annotation file that has only 1 page.

Example

C#
VB
using Leadtools.Windows.Controls; 
using Leadtools.Windows.Annotations; 
using Leadtools.Demos; 
using Leadtools.Help; 
 
public void AnnCodecs_DeletePage(string fileName) 
{ 
   // create a new annotation container 
   AnnContainer container = new AnnContainer(); 
 
   // add a few objects into the container 
   AnnRectangleObject 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 class 
   AnnCodecs codecs = new AnnCodecs(); 
 
   // save this container into a file 
   // save the objects in this container 
   codecs.Save(fileName, container, AnnCodecsFormat.NativeXml, 1, AnnCodecsSavePageMode.Overwrite); 
 
   // get information about the file 
   AnnCodecsInformation 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 file 
   information = new AnnCodecsInformation(); 
   codecs.GetInformation(fileName, information); 
   MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages)); 
 
   // delete the first page 
   codecs.DeletePage(fileName, 1); 
 
   // get information about the file 
   information = new AnnCodecsInformation(); 
   codecs.GetInformation(fileName, information); 
   MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages)); 
} 
Imports Leadtools.Windows.Controls 
Imports Leadtools.Windows.Annotations 
 
Public Sub AnnCodecs_DeletePage(ByVal fileName As String) 
   ' create a new annotation container 
   Dim container As AnnContainer = New AnnContainer() 
 
   ' add a few objects into the container 
   Dim rectObj As AnnRectangleObject = New AnnRectangleObject() 
   rectObj.Rect = New Rect(100, 100, 100, 100) 
   rectObj.Stroke = Colors.Blue 
   rectObj.StrokeThickness = 1.0 
   rectObj.Fill = Nothing 
   container.Children.Add(rectObj) 
 
   Dim lineObj As AnnLineObject = 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 class 
   Dim codecs As AnnCodecs = New AnnCodecs() 
 
   ' save this container into a file 
   ' save the objects in this container 
   codecs.Save(fileName, container, AnnCodecsFormat.NativeXml, 1, AnnCodecsSavePageMode.Overwrite) 
 
   ' get information about the file 
   Dim 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 file 
   information = New AnnCodecsInformation() 
   codecs.GetInformation(fileName, information) 
   MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages)) 
 
   ' delete the first page 
   codecs.DeletePage(fileName, 1) 
 
   ' get information about the file 
   information = New AnnCodecsInformation() 
   codecs.GetInformation(fileName, information) 
   MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages)) 
End Sub 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Windows.Annotations Assembly