AnnRectLeft 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 creates two annotation notes as a single undo operation*/
void __fastcall TForm1::AnnAddUndoNodeClick(TObject *Sender)
{
   long hObject1;
   long hObject2;

   //Call the AddUndoNode method to add an undo node to the container.
   pRasterAnn->AnnAddUndoNode ();

   //Disable the undo feature
   pRasterAnn->AnnUndoEnable = False;

   //Perform the operations to be combined into one undo.
   pRasterAnn->AnnCreate (ANN_OBJECT_NOTE, true, true);
   hObject1= pRasterAnn->AnnObject;
   pRasterAnn->set_AnnRectLeft (hObject1, 0);
   pRasterAnn->set_AnnRectTop (hObject1, 0);
   pRasterAnn->set_AnnRectWidth (hObject1, 100);
   pRasterAnn->set_AnnRectHeight (hObject1, 100);

   pRasterAnn->AnnCreate (ANN_OBJECT_NOTE, true, true);
   hObject2= pRasterAnn->AnnObject;
   pRasterAnn->set_AnnRectLeft(hObject2, 0);
   pRasterAnn->set_AnnRectTop(hObject2, 100);
   pRasterAnn->set_AnnRectWidth(hObject2, 100);
   pRasterAnn->set_AnnRectHeight(hObject2, 100);

   //Re-enable the undo feature
   pRasterAnn->AnnUndoEnable = True;
}