I don't get it... This doesn't work either.
Code:For Each origProp As PropertyItem In img.PropertyItems il.Images.Item(0).SetPropertyItem(origProp) Next MsgBox(il.Images(0).PropertyItems.Length) ' Length = 0
|
|
I'm stumped... As soon as an Image with PropertyItems is put into the ImageList, it appears to lose that data. Anyone know why this is happening and how to resolve it?
Code:' il is of type ImageList; img is of type Image. MsgBox(img.PropertyItems.Length) ' Length = 68 il.Images.Add(img) MsgBox(il.Images(0).PropertyItems.Length) ' Length = 0 MsgBox(img.Clone.PropertyItems.Length) ' Length = 68 il.Images(0) = img.Clone MsgBox(il.Images(0).PropertyItems.Length) ' Length = 0
I don't get it... This doesn't work either.
Code:For Each origProp As PropertyItem In img.PropertyItems il.Images.Item(0).SetPropertyItem(origProp) Next MsgBox(il.Images(0).PropertyItems.Length) ' Length = 0
I just ran this code: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:Code:Dim img = Image.FromFile(filePath) Me.ImageList1.Images.Add(img) MessageBox.Show((img Is Me.ImageList1.Images(0)).ToString)Presumably the image format supported by your ImageList doesn't support property items.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).
2007, 2008, 2009, 2010
Why is my data not saved to my database? | Communicating between multiple forms
MSDN: Data Walkthroughs | "How Do I?" Videos
My Blog: Custom Events | Dynamic GDI+ Drawing
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks