AnnSetAutoMenuItemEnable 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();
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
   // disable the Delete menu item from all the selected objects
   pRasterAnn->AnnSetAutoMenuItemEnable (pRasterAnn->AnnContainer, 0, ANN_AUTOTEXT_MENU_DELETE, ANN_MENU_DISABLED, ANN_FLAG_RECURSE + ANN_FLAG_SELECTED, AnsiToOLESTR(""));
   // disable the Delete menu item from all the ellipse objects
   pRasterAnn->AnnSetAutoMenuItemEnable (pRasterAnn->AnnAutomation, ANN_OBJECT_ELLIPSE, ANN_AUTOTEXT_MENU_DELETE, ANN_MENU_DISABLED, 0, AnsiToOLESTR(""));
}