AnnAutomation Property Example for C++ Builder
#include "l_bitmap.h"
//Global declarations
1LEADRasterAnnotation * 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 shows how you can use the AnnAutomation property
//to access the automation object through API functions.
//You must link to the ltann_bc.lib import lib
#include "l_bitmap.h"
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int nRet;
unsigned int IsBold; //Is the object's text bold
long hAnnObject;
hAnnObject = pRasterAnn->AnnAutomation;
// Toggle the default font bold property
L_AnnGetFontBold ((void *)hAnnObject, &IsBold);
if (IsBold != 0)
ShowMessage ("Removing bold");
else
ShowMessage ("Making bold");
nRet = L_AnnSetFontBold ((void * )hAnnObject, !IsBold, 0);
if (nRet != 1)
ShowMessage ("L_AnnSetFontBold failed: " + IntToStr(nRet));
}
}