ContinueBrowse (Thumbnail Browser Control) example for Delphi
1. |
Add the following units to the uses section: |
LEADDef, LEADTyp.
2. |
In the private section of the TForm1 class add the following decleration: |
private
{ Private declarations }
nCount : Integer;
3. |
Add the following to the TForm1.FormCreate procedure |
procedure TForm1.FormCreate(Sender: TObject);
begin
nCount := 0 ;
end;
4. |
Add the following code to the thumbnail event handler: |
procedure TForm1.LEADThumb1ThumbnailEvent(Sender: TObject;
Bitmap: TBitmapHandle; FileName: String; nStatusCode, nPercent: Integer);
var
out : string;
begin
if (nStatusCode = 0) then {successful thumbnail generation}
begin
{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 then {allow max of 20 thumbnails}
begin
LEADThumb1.ContinueBrowse := False; {stop the browse}
nCount := 0;
exit;
end ;
out := FileName + #10;
out := out + 'Format: ' +IntToStr(LEADThumb1.InfoFormat)+ #10;
out := out + 'Compression: ' +LEADThumb1.InfoCompression + #10;
out := out + 'Bits: ' +IntToStr(LEADThumb1.InfoBits)+ #10;
out := out + 'Width: ' +IntToStr(LEADThumb1.InfoWidth)+ #10;
out := out + 'Height: ' +IntToStr(LEADThumb1.InfoHeight)+ #10;
out := out + 'Page: ' +IntToStr(LEADThumb1.InfoPage)+ #10;
out := out + 'TotalPages: ' +IntToStr(LEADThumb1.InfoTotalPages) + #10;
out := out + 'SizeDisk: ' +IntToStr(LEADThumb1.InfoSizeDisk) + #10;
out := out + 'SizeMem: ' +IntToStr(LEADThumb1.InfoSizeMem) + #10;
out := out + 'XRes: ' +IntToStr(LEADThumb1.InfoXRes) + #10;
out := out + 'YRes: ' +IntToStr(LEADThumb1.InfoYRes )+ #10;
ShowMessage(out);
end ;
LEADThumb1.ContinueBrowse := True; {continue the browse operation}
end;