modify. These properties are the size of the thumbnail, the position, background color, border size, and the width & color of the border line. The thumbnail generation properties are the following: disable magnification and compression with fix aspect or with distortion. The browsing properties are: recursion of directories, browse into multi-page files, file selection type and maximum file size.

The thumbnail control comes with sample application written in several languages to help developers, such as C++, C#, J#, VB, Delphi, and VB.NET.

The following sample C++ code demonstrates how simple it is to set the displaying properties, thumbnail generation properties and browsing properties. Once the properties are set, the browsing process is started.

// set displaying properties
m_biThumb.SetImageSize(253, 200);
m_biThumb.SetBorderSize(5);
m_biThumb.SetBgColor(RGB(255, 255, 255));
m_biThumb.SetBorderLine(1, RGB(0, 0, 0));

// set thumbnail generation properties
m_biThumb.SetEnableMagnification(false);
m_biThumb.SetAspectFixation(true);

// set browsing properties
m_biThumb.SetRecursiveBrowsing(true);
m_biThumb.SetMultipageExpanding(true);
m_biThumb.SetSelectionOptions(SO_ALLIMAGEFILES);

// start browsing
m_biThumb.BrowseInDirectory("C:\\");
 

The following code contains the event handler function that displays the current thumbnail and gets the information of the image.
 

LRESULT CThumbnailLowDlg::OnThumbnailEventHandler(WPARAM wParam, LPARAM lParam)
{
// it must be call
BiThumbnailInfo* info = reinterpret_cast<BiThumbnailInfo*>(lParam);

// add your code here

// display thumbnail

CClientDC dc(this);
HBITMAP bmp;
if(info->bitmap){
bmp = info->bitmap;
}else{
bmp = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP_ILLEGAL));
}
m_biThumb.DisplayThumbnail(dc, 12, 45, bmp);

// load image information into a list control
CString strInfo;
if(info->info.isLegal){
strInfo.Format("%s", info->info.format);
m_properties.SetItemText(0, 1, strInfo);
strInfo.Format("%i", info->info.width);
m_properties.SetItemText(1, 1, strInfo);
strInfo.Format("%i", info->info.height);
m_properties.SetItemText(2, 1, strInfo);
strInfo.Format("%i", info->info.resX);
m_properties.SetItemText(3, 1, strInfo);
strInfo.Format("%i", info->info.resY);
m_properties.SetItemText(4, 1, strInfo);
strInfo.Format("%i", info->info.depth);
m_properties.SetItemText(5, 1, strInfo);
}
// it must be call
BiThumbnail::DestroyThumbnailInfo(info);
return 0;
}

Page 1 Page 2 Page 3