LineRemove example for C++ Builder
LEADRasterProcess * pRasterProc= NULL;
/*Create the RasterProcess object and UnlockSupport*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//.....
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
LEADRasterView1->Raster->UnlockSupport (L_SUPPORT_DOCUMENT, AnsiToOLESTR("TestKey"));
LEADEventSink1->Connect (pRasterProc, DIID__LEADRasterProcessEvents);
//.....
}
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if(pRasterProc)
pRasterProc->Release();
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
/*Line Remove
This examples removes vertical lines that are at least 200 pixels in length
and no more than 5 pixels in width
The lines can have gaps up to two pixels in length
The LineRemove Event is used to display information about each line removed*/
pRasterProc->EnableDocCleanEvents = true;
pRasterProc->LineRemove (LEADRasterView1->Raster, LINE_USE_GAP, 200, 5, 7, 10, 2, 0, LINEREMOVE_HORIZONTAL);
}
void __fastcall TForm1:: LEADEventSink1Invoke(TObject *Sender, int DispID,
const TGUID &IID, int LocaleID, WORD Flags, tagDISPPARAMS &Params,
Pointer varResult, Pointer ExcepInfo, Pointer ArgErr)
{
switch (DispID)
{
case LEADRASTERPROCESSEVENTS_LINEREMOVE:
{
float fStartRow= (OleVariant)(Params.rgvarg[3]);
float fStartCol= (OleVariant)(Params.rgvarg[2]);
float fLength= (OleVariant)(Params.rgvarg[1]);
AnsiString strTemp;
strTemp = "Line at [R,C] " + FloatToStr(fStartRow) + "," + FloatToStr(fStartCol) +
" Length=" + FloatToStr(fLength);
OutputDebugString(strTemp.c_str());
}
break;
}
}