ContinueBrowse (Thumbnail Browser Control) example for C++ Builder
1. |
In the private section of the TForm1 class add the following decleration: |
private: // User declarations…
int nCount;
2. |
Add the following to the TForm1.FormCreate void __fastcall |
void __fastcall TForm1.FormCreate(TObject *Sender)
{
…
nCount = 0 ;
…
}
3. |
Add the follwing code to the thumbnail event handler: |
void __fastcall TForm1::LEADThumb1ThumbnailEvent(TObject *Sender,
TBitmapHandle Bitmap, AnsiString FileName, int nStatusCode,
int nPercent)
{
AnsiString out;
if( (nStatusCode == 0)) /*successful thumbnail generation*/
{
/*save thumbnails in a multipage TIFF file*/
LEADImage1->Bitmap = Bitmap;
LEADImage1->Save("c:\\temp\\thumbs.tif", FILE_TIF, 24, 0, SAVE_APPEND);
nCount = nCount + 1;
if( nCount > 20) /*allow max of 20 thumbnails*/
{
LEADThumb1->ContinueBrowse = False; /*stop the browse*/
nCount = 0;
return;
}
out = FileName + ‘\n’;
out = out + "Format: " +IntToStr(LEADThumb1->InfoFormat)+ '\n';
out = out + "Compression: " +LEADThumb1->InfoCompression + '\n';
out = out + "Bits: " +IntToStr(LEADThumb1->InfoBits)+ '\n';
out = out + "Width: " +IntToStr(LEADThumb1->InfoWidth)+ '\n';
out = out + "Height: " +IntToStr(LEADThumb1->InfoHeight)+ '\n';
out = out + "Page: " +IntToStr(LEADThumb1->InfoPage)+ '\n';
out = out + "TotalPages: " +IntToStr(LEADThumb1->InfoTotalPages) + '\n';
out = out + "SizeDisk: " +IntToStr(LEADThumb1->InfoSizeDisk) + '\n';
out = out + "SizeMem: " +IntToStr(LEADThumb1->InfoSizeMem) + '\n';
out = out + "XRes: " +IntToStr(LEADThumb1->InfoXRes) + '\n';
out = out + "YRes: " +IntToStr(LEADThumb1->InfoYRes )+ '\n';
ShowMessage(out);
}
LEADThumb1->ContinueBrowse = True; /*continue the browse operation*/
}