AnnGetObjectFromTag example for C++ Builder
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 example retrieves the annotation handle for tag no. 1
void __fastcall TForm1::Button2Click(TObject *Sender)
{
AnsiString Msg;
long hTagObject;
long lTag;
ShowMessage ("I Will Looking For an Object With Tag = 1");
pRasterAnn->AnnGetObjectFromTag (pRasterAnn->AnnContainer, 1, False);
hTagObject= pRasterAnn->AnnTagObject;
pRasterAnn->AnnGetTag (hTagObject);
lTag= pRasterAnn->AnnTag;
if (lTag== 1)
{
sprintf(Msg.c_str(), "Annotation Found with tag 1 : %x", hTagObject);
ShowMessage (Msg.c_str());
}
else
ShowMessage ("Annotation NOT found with tag 1 ");
}