Visual Basic (Declaration) | |
---|---|
<DefaultPropertyAttribute("ViewStyle")> <ToolboxBitmapAttribute()> <DefaultEventAttribute("SelectedIndexChanged")> Public Class RasterThumbnailBrowser Inherits RasterImageList |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
[DefaultPropertyAttribute("ViewStyle")] [ToolboxBitmapAttribute()] [DefaultEventAttribute("SelectedIndexChanged")] public class RasterThumbnailBrowser : RasterImageList |
C++/CLI | |
---|---|
[DefaultPropertyAttribute("ViewStyle")] [ToolboxBitmapAttribute()] [DefaultEventAttribute("SelectedIndexChanged")] public ref class RasterThumbnailBrowser : public RasterImageList |
This example creates an instance of a RasterThumbnailBrowser control and adds it to a form Next it displays thumbnail images of all images in a directory
Visual Basic | Copy Code |
---|---|
Private Class MyForm : Inherits Form |
C# | Copy Code |
---|---|
class MyForm : Form |
The RasterThumbnailBrowser lets you quickly and easily create thumbnails for images that reside on any file folder in the system. Since the RasterThumbnailBrowser derives from the RasterImageList control, you get all the visual styles available to the image list (different view styles, control the item size, color, etc.) as well as the same interface to manually add/remove/edit items.
You call the RasterThumbnailBrowser.LoadThumbnails(String,String,RasterThumbnailBrowserLoadFlags) method passing it the path of the folder for which you want to create thumbnails, a search pattern and a boolean value indicating whether you want the control to block until all thumbnails are created or to return immediately and continue loading the thumbnails in a background thread.
The control will first read the folder and create the items you need. These items will initially have a default "loading" thumbnail set in their RasterImageListItem.Image that you can access and change through the LoadingThumbnail property. Once the item image file is loaded and its thumbnail extracted, the control will replace the item RasterImageListItem.Image property with the correct thumbnail. This gives the user a visual feedback on which items are loaded and which are yet to be loaded. If the control cannot load a certain file (for example, if the file is not a valid image format file), an "error" thumbnail will be used in the item. You can access and change this thumbnail image through the ErrorThumbnail property.
During the loading operation, you can check the IsLoadingThumbnails property to determine if the control is still loading thumbnails in the background. The FinishedLoadingThumbnails event will fire when the loading operation is done. You can subscribe to the LoadThumbnail event to get feedback about the item currently being loaded. You use this event also to update a progress bar on your application and to cancel the load process if neeeded. The CancelLoadingThumbnails method lets you cancel the load operation at any time.
The ThumbnailSizeFlags property lets you control the quality of the thumbnail images created by the RasterThumbnailBrowser control.
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
Leadtools.WinForms.RasterImageList
Leadtools.WinForms.RasterThumbnailBrowser
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family