A thumbnail can be added or inserted into the collection by defining a ThumbnailItem, and then using the FromStream method to specify a stream from which to acquire the image data. Then call the ThumbnailItemCollection methods InsertItemFromStream or AddItemFromStream.
![]() |
The ThumbnailItemCollection Add method cannot be used to add an item from stream. |
| C# | Copy Code |
|---|---|
// Generate a thumbnail from stream. System.IO.FileStream theFile; ThumbnailItem theThumbnail; theFile = new System.IO.FileStream("c:\\bird.jpg", System.IO.FileMode.Open, System.IO.FileAccess.Read); theThumbnail = thumbnailXpress1.CreateThumbnailItem("", 1, ThumbnailType.Image); theFile.Seek(0, System.IO.SeekOrigin.Begin); theThumbnail.FromStream(theFile); theThumbnail.Descriptor = "bird.jpg"; theThumbnail.UserTag = theFile.Name; thumbnailXpress1.Items.AddItemFromStream(theThumbnail); theFile.Close(); |
|
