CreateSample Example for Visual C++ 5.0
void CConViewView::OnCellTag (long hDC, long lCellIndex, long lLeft, long lTop, long lWidth, long lHeight)
{
CDC dc;
dc.Attach((HDC) hDC);
if (lCellIndex == 1)
{
// draw an overlay with italic font
static LOGFONT lf;
CFont Font, OldFont;
lf.lfHeight = lHeight;
lf.lfItalic = TRUE;
wsprintf(lf.lfFaceName, "Times new Roman\0");
Font.CreateFontIndirect(&lf);
dc.SelectObject(Font) ;
dc.SetTextAlign(TA_BOTTOM | TA_RIGHT);
dc.SetTextColor(RGB(255, 255, 255));
dc.TextOut(lWidth + lLeft, lHeight + lTop, "Owner Text", 10);
}
dc.Detach();
}
void CreateSample(CLEADRasterContainerViewer * pLEADContainerViewer)
{
TRY
{
char * MedicalKey = "";
pLEADContainerViewer->SetEnableMethodErrors (TRUE);
pLEADContainerViewer->RemoveCell (-1 ,TRUE, 0);
ILEADRaster* pRaster = NULL;
CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRaster);
pRaster->UnlockSupport (L_SUPPORT_MEDICAL, TEXT(MedicalKey));
ILEADRasterIO* pRasterIO= NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);
//Load IMAGE1.dic from LEAD Technologies setup directory
pRasterIO->Load (pRaster, "C:\\LEAD Technologies, Inc\\LEADTOOLS14\\Images\\IMAGE1.dic", 0, 0, -1);
// Insert a new cell at the end of the container cell queue.
long iCellIndex = pLEADContainerViewer->InsertCell (-1, 0);
// Attach the loaded raster to the newly inserted cell.
pLEADContainerViewer->Cell (iCellIndex).InsertBitmapList (pRaster, TRUE, 0);
// Add some tags to the cell
pLEADContainerViewer->Cell(iCellIndex).AddTag ( 0, CONVIEW_CELLALIGN_TOPLEFT , 0, "Image1 Text 1", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 1, CONVIEW_CELLALIGN_TOPLEFT , 0, "Image1 Text 2", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 2, CONVIEW_CELLALIGN_TOPLEFT , 0, "Image1 Text 3", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 3, CONVIEW_CELLALIGN_TOPLEFT , 0, "Image1 Text 4", 0);
pLEADContainerViewer->Cell (iCellIndex).AddTag( 1, CONVIEW_CELLALIGN_LEFTCENTER , 0, "L", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_BOTTOMLEFT , 0, "Image1 Text 5", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_TOPCENTER , 0, "Top", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_BOTTOMCENTER, 0, "Bottom", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_TOPRIGHT , 0, "Image1 Text 6", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_RIGHTCENTER , 0, "R", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 8, CONVIEW_CELLALIGN_TOPLEFT , CONVIEW_CELLTAG_FRAME, NULL, 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 3, CONVIEW_CELLALIGN_BOTTOMLEFT , CONVIEW_CELLTAG_WLCENTERWIDTH , NULL, 0);
//Load IMAGE2.dic from LEAD Technologies setup directory
pRasterIO->Load (pRaster, "C:\\LEAD Technologies, Inc\\LEADTOOLS14\\Images\\IMAGE2.dic", 0, 0, -1);
// insert a new cell at the end of the container queue.
iCellIndex = pLEADContainerViewer->InsertCell (-1, 0);
// Attach the loaded bitmap list to the newly inserted cell.
pLEADContainerViewer->Cell(iCellIndex).InsertBitmapList (pRaster, TRUE, 0);
// Add some tags to the cell
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_TOPLEFT , 0, "Image3 Text 1", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 2, CONVIEW_CELLALIGN_TOPLEFT , 0, "Image3 Text 2", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 4, CONVIEW_CELLALIGN_TOPLEFT , 0, "Image3 Text 3", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 6, CONVIEW_CELLALIGN_TOPLEFT , 0, "Image3 Text 4", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 1, CONVIEW_CELLALIGN_LEFTCENTER , 0, "Image3 Text 5", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_BOTTOMLEFT , 0, "Image3 Text 6", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_TOPCENTER , 0, "Image3 Text 7", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_BOTTOMCENTER, 0, "Image3 Text 8", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_TOPRIGHT , 0, "Image3 Text 9", 0);
pLEADContainerViewer->Cell(iCellIndex).AddTag( 0, CONVIEW_CELLALIGN_RIGHTCENTER , 0, "R", 0);
pLEADContainerViewer->Cell (iCellIndex).AddTag ( 7, CONVIEW_CELLALIGN_TOPLEFT , CONVIEW_CELLTAG_SCALE, NULL, 0);
ILEADContainerViewerProperties * pContainerViewerProps = NULL;
HRESULT hr = CoCreateInstance( CLSID_LEADContainerViewerProperties, NULL, CLSCTX_ALL,
IID_ILEADContainerViewerProperties,(void**)&pContainerViewerProps );
// Change the number of rows and cols to show all the inserted cells.
pContainerViewerProps->PutColumnCount (2);
pContainerViewerProps->PutRowCount (1);
pContainerViewerProps->PutIncludedParameters (CONVIEW_CIP_ROWCOUNT | CONVIEW_CIP_COLUMNCOUNT);
pLEADContainerViewer->SetContainerProperties (pContainerViewerProps, 0);
// Change the number of sub-rows and sub-cols of Cell 0.
pLEADContainerViewer->Cell (0).SetSubRowCount (3);
pLEADContainerViewer->Cell(0).SetSubColumnCount (3);
//Add owner action tag.
pLEADContainerViewer->Cell(0).AddTag ( 0, CONVIEW_CELLALIGN_BOTTOMRIGHT , CONVIEW_CELLTAG_OWNERDRAW, NULL, 0);
//Reposition Cell 0.
pLEADContainerViewer->Cell(0).RepositionCell(1);
pRasterIO->Release();
pContainerViewerProps->Release();
pRaster->Release();
}
CATCH_ALL(e)
{
e->ReportError();
}
END_CATCH_ALL
}
void CConViewView::OnCreateExample()
{
CreateSample(&m_ConView);
}