AnnDeletePageMemory 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:
Private Sub SampleAnnFileInfoMemory_Click()
Dim nRet As Integer
Dim strFormat As String
Dim strMsg As String
Dim lSize As Long
Dim uFormat As AnnFMTConstants
uFormat = ANN_FMT_NATIVE
'Save as the first page of the annotation file
Dim hGlobal As Long
hGlobal = 0
RasterAnn.AnnSaveMemory hGlobal, uFormat, False, lSize, SAVE_OVERWRITE, 0
'Flip the container, and save as the second page (insert before page 2)
RasterAnn.AnnFlip True, LEADRasterView1.Raster.BitmapHeight / 2, False
RasterAnn.AnnSaveMemory hGlobal, uFormat, False, lSize, 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
RasterAnn.AnnRotate False, LEADRasterView1.Raster.BitmapWidth / 2, LEADRasterView1.Raster.BitmapHeight / 2, 45, False
RasterAnn.AnnSaveMemory hGlobal, uFormat, False, lSize, SAVE_APPEND, 0
'Verify contents of file
nRet = RasterAnn.AnnFileInfoMemory (hGlobal, lSize)
If (nRet = 0) Then
Select Case RasterAnn.AnnInfoFormat
Case ANN_FMT_NATIVE
strFormat = "ANN_FMT_NATIVE"
Case ANN_FMT_WMF
strFormat = "ANN_FMT_WMF"
Case ANN_FMT_ENCODED
strFormat = "ANN_FMT_ENCODED"
Case Else
strFormat = "Unknown"
End Select
strMsg = ""
strMsg = strMsg + "Format: " + strFormat + Chr(13)
strMsg = strMsg + "Version: " + Str(RasterAnn.AnnInfoVersion) + Chr(13)
strMsg = strMsg + "Total Pages: " + Str(RasterAnn.AnnInfoTotalPages) + Chr(13)
strMsg = strMsg + "Total Size: " + Str(lSize) + Chr(13)
MsgBox strMsg
Else
MsgBox "Invalid Annotation Memory File"
End If
'Now delete the second page, and display information
RasterAnn.AnnDeletePageMemory hGlobal, 2
lSize = RasterAnn.AnnPageMemorySize
'Verify contents of file
nRet = RasterAnn.AnnFileInfoMemory (hGlobal, lSize)
If (nRet = 0) Then
Select Case RasterAnn.AnnInfoFormat
Case ANN_FMT_NATIVE ' Cut command.
strFormat = "ANN_FMT_NATIVE"
Case ANN_FMT_WMF ' Copy command.
strFormat = "ANN_FMT_WMF"
Case ANN_FMT_ENCODED ' Clear command.
strFormat = "ANN_FMT_ENCODED"
Case Else
strFormat = "Unknown"
End Select
strMsg = ""
strMsg = strMsg + "Format: " + strFormat + Chr(13)
strMsg = strMsg + "Version: " + Str(RasterAnn.AnnInfoVersion) + Chr(13)
strMsg = strMsg + "Total Pages: " + Str(RasterAnn.AnnInfoTotalPages) + Chr(13)
strMsg = strMsg + "Total Size: " + Str(lSize) + Chr(13)
MsgBox strMsg
Else
MsgBox "Invalid Annotation File"
End If
'If finished with hGlobal, then free the memory by calling GlobalFree
End Sub