AnnDeletePage example for C++ Builder
/*This sample saves the annotations as the first page of a multipage annotation file
The format is specified by the //uFormat// parameter (either ANNFMT_NATIVE or ANNFMT_ENCODED)
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*/
void TForm1::SampleAnnSave(AnsiString strFileName , int uFormat)
{
int nRet;
AnsiString strFormat;
AnsiString strMsg;
//Save as the first page of the annotation file
LEADAnn1->AnnSave (strFileName, uFormat, False, SAVE_OVERWRITE, 0);
//Flip the container, and save as the second page (insert before page 2)
LEADAnn1->AnnFlip (True, LEADAnn1->BitmapHeight / 2, False);
LEADAnn1->AnnSave (strFileName, 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
LEADAnn1->AnnRotate (False, LEADAnn1->BitmapWidth / 2, LEADAnn1->BitmapHeight / 2, 45, False);
LEADAnn1->AnnSave (strFileName, uFormat, False, SAVE_APPEND, 0);
//Verify contents of file
nRet= LEADAnn1->AnnFileInfo(strFileName);
if (nRet == SUCCESS)
{
switch (LEADAnn1->AnnInfoFormat)
{
case ANNFMT_NATIVE:
strFormat= "ANNFMT_NATIVE";
break;
case ANNFMT_WMF:
strFormat= "ANNFMT_WMF";
break;
case ANNFMT_ENCODED:
strFormat= "ANNFMT_ENCODED";
break;
default:
strFormat= "Unknown";
}
strMsg = "File: " + strFileName + "\n";
strMsg = strMsg + "Format: " + strFormat + "\n";
strMsg = strMsg + "Version: " + IntToStr(LEADAnn1->AnnInfoVersion) + "\n";
strMsg = strMsg + "Total Pages: " + IntToStr(LEADAnn1->AnnInfoTotalPages) + "\n";
ShowMessage (strMsg);
}
else
ShowMessage ("Invalid Annotation File: " + strFileName);
//Now delete the second page, and display information
LEADAnn1->AnnDeletePage (strFileName, 2);
//Verify contents of file
nRet = LEADAnn1->AnnFileInfo(strFileName);
if (nRet == SUCCESS)
{
switch (LEADAnn1->AnnInfoFormat)
{
case ANNFMT_NATIVE: // Cut command
strFormat = "ANNFMT_NATIVE";
break;
case ANNFMT_WMF: // Copy command
strFormat = "ANNFMT_WMF";
break;
case ANNFMT_ENCODED: // Clear command
strFormat = "ANNFMT_ENCODED";
break;
default:
strFormat = "Unknown";
}
strMsg = "File: " + strFileName + "\n";
strMsg = strMsg + "Format: " + strFormat + "\n";
strMsg = strMsg + "Version: " + IntToStr(LEADAnn1->AnnInfoVersion) + "\n";
strMsg = strMsg + "Total Pages: " + IntToStr(LEADAnn1->AnnInfoTotalPages) + "\n";
ShowMessage (strMsg);
}
else
ShowMessage ("Invalid Annotation File: " + strFileName);
}