AnnDeletePageArray example for Visual Basic
'This sample saves the annotations as the first page of a multipage annotation file in memory
'The annotations are flipped, and saved as the second page
'The annotations are rotated, and saved as the third page
'Information is displayed about the annotation file
'The second page is deleted, and information is again displayed about the annotation file
'Assume this global declaration:
' Dim AnnVariant as VARIANT
Private Sub SampleAnnFileInfoArray_Click()
Dim nRet As Integer
Dim strFormat As String
Dim strMsg As String
Dim uFormat As Long
uFormat = ANNFMT_ENCODED
AnnVariant = Empty
'Save as the first page of the annotation file
nRet = LEAD1.AnnSaveArray (AnnVariant, uFormat, False, SAVE_OVERWRITE, 0)
'Flip the container, and save as the second page (insert before page 2)
LEAD1.AnnFlip True, LEAD1.BitmapHeight / 2, False
nRet = LEAD1.AnnSaveArray(AnnVariant, uFormat, False, SAVE_INSERT, 2)
'Rotate the container, and save as the third page
'Here we could pass the SAVE_INSERT flag and 3 for nPage,
'but instead we will use the SAVE_APPEND flag
LEAD1.AnnRotate False, LEAD1.BitmapWidth / 2, LEAD1.BitmapHeight / 2, 45, False
LEAD1.AnnSaveArray AnnVariant, uFormat, False, SAVE_APPEND, 0
'Verify contents of file
nRet = LEAD1.AnnFileInfoArray(AnnVariant)
If (nRet = 0) Then
Select Case LEAD1.AnnInfoFormat
Case ANNFMT_NATIVE
strFormat = "ANNFMT_NATIVE"
Case ANNFMT_WMF
strFormat = "ANNFMT_WMF"
Case ANNFMT_ENCODED
strFormat = "ANNFMT_ENCODED"
Case Else
strFormat = "Unknown"
End Select
strMsg = ""
strMsg = strMsg + "Format: " + strFormat + Chr(13)
strMsg = strMsg + "Version: " + Str(LEAD1.AnnInfoVersion) + Chr(13)
strMsg = strMsg + "Total Pages: " + Str(LEAD1.AnnInfoTotalPages) + Chr(13)
MsgBox strMsg
Else
MsgBox "Invalid Annotation Memory File"
End If
'Now delete the second page, and display informtion
LEAD1.AnnDeletePageArray AnnVariant, 2
'Verify contents of file
nRet = LEAD1.AnnFileInfoArray(AnnVariant)
If (nRet = 0) Then
Select Case LEAD1.AnnInfoFormat
Case ANNFMT_NATIVE ' Cut command.
strFormat = "ANNFMT_NATIVE"
Case ANNFMT_WMF ' Copy command.
strFormat = "ANNFMT_WMF"
Case ANNFMT_ENCODED ' Clear command.
strFormat = "ANNFMT_ENCODED"
Case Else
strFormat = "Unknown"
End Select
strMsg = ""
strMsg = strMsg + "Format: " + strFormat + Chr(13)
strMsg = strMsg + "Version: " + Str(LEAD1.AnnInfoVersion) + Chr(13)
strMsg = strMsg + "Total Pages: " + Str(LEAD1.AnnInfoTotalPages) + Chr(13)
MsgBox strMsg
Else
MsgBox "Invalid Annotation File"
End If
'If finished with AnnVariant, then free the memory by setting to empty
End Sub