Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Sun Sep 09, 2007 5:14 am Post subject: HOWTO: Specify a custom thumbnail for a normal item |
|
|
To specify a custom thumbnail to a normal item( that is, an item belonging to the shell's namespace and not added to FileView using AddCustomItem), use the following code in the AfterItemAdd event of FileView
[C#]
private void fileView1_AfterItemAdd(object sender, LogicNP.FileViewControl.FileViewEventArgs e)
{
// Only change icon index if FileView is in thumbnail mode
if(fileView1.ViewStyle==ViewStyles.Thumbnails)
{
// Replace following condition with your own condition
// Only display a custom thumbnail for folders
if(e.Item.IsFolder())
{
// Add a custom thumbnail to the thumbnail image list of FileView
int index = fileView1.AddCustomIcon(new Bitmap(@"C:\my_thumbnail.bmp"),FileViewImageLists.ThumbnailFramed);
// Change the icon index of the item to that returned by the previous method
e.Item.IconIndex=index;
}
}
} |
|