View Single Post
  #3 (permalink)  
Old 07-12-2009, 11:21 PM
jmcilhinney's Avatar
jmcilhinney jmcilhinney is offline
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Aug 2004
Location: Sydney, Australia
Age: 40
Posts: 6,118
Reputation: 541
jmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalist
Default

I just ran this code:
Code:
Dim img = Image.FromFile(filePath)

Me.ImageList1.Images.Add(img)
MessageBox.Show((img Is Me.ImageList1.Images(0)).ToString)
and got False, i.e. the Image object I added to the ImageList is not the Image stored in the ImageList. A new Image object is created based on the image properties defined by the ImageList. I don't know whether that is always the case but it obviously is in some cases at least. The documentation for the Image.PropertyItems property says:
Quote:
If the image has no property items or if the image format does not support property items, PropertyItems returns an empty array (that is, an array of length zero).
Presumably the image format supported by your ImageList doesn't support property items.
Reply With Quote