AnnSaveTag example for C++ Builder
Note: |
Also works with Access 95 and 97. |
Note: |
This topic is for Document/Medical only. |
//Global declarations
LEADRasterAnnotation * pRasterAnn= NULL;
LEADRasterAnnToolBar* pRasterAnnToolbar= NULL;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
CoCreateInstance(CLSID_LEADRasterAnnotation, NULL, CLSCTX_ALL, IID_ILEADRasterAnnotation, (void**)&pRasterAnn);
CoCreateInstance(CLSID_LEADRasterAnnToolBar, NULL, CLSCTX_ALL, IID_ILEADRasterAnnToolBar, (void**)&pRasterAnnToolbar);
pRasterAnn->AnnParentRasterView = LEADRasterView1->Raster;
LEADEventSink1->Connect (pRasterAnn, DIID__LEADRasterAnnotationEvents);
pRasterAnn->AnnUserMode = ANN_USERMODE_DESIGN ;
}
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if (pRasterAnn)
pRasterAnn->Release ();
if (pRasterAnnToolbar)
pRasterAnnToolbar-> Release();
}
/*This sample saves all objects in Wang TIFF tag, clears the rasterview control, and reloads the image.*/
void __fastcall TForm1::AnnSaveTagClick(TObject *Sender)
{
LEADRasterIO * pRasterIO= NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);
pRasterAnn->AnnSaveTag (pRasterIO, true, false);
pRasterIO->Save (LEADRasterView1->Raster, AnsiToOLESTR("c:\\testwang.tif"), FILE_CCITT_GROUP4, 1, (QFactorConstants)2, SAVE_OVERWRITE);
//clear the LEAD raster view control
LEADRasterView1->Raster->Bitmap = 0;
//Reload the image with the wang-compatible annotations
pRasterIO->Load (LEADRasterView1->Raster, AnsiToOLESTR("c:\\testwang.tif"), 0, 0, 1);
pRasterAnn->AnnLoad (AnsiToOLESTR("c:\\testwang.tif"), 1);
pRasterAnn->AnnUserMode = ANN_USERMODE_DESIGN;
pRasterIO->Release();
}