View Full Version : ListView images problem

08-25-2009, 05:56 PM
I'm having problems to get icons to display in ListView. My code is:

rollout roller "Imagelist" width:400 height:800
dotNetControl imageView "System.Windows.Forms.ListView" width:380 height:780

fn initImageView lv =
local items = #()
imageList = dotNetObject "System.Windows.Forms.ImageList"
imageClass = dotNetClass "System.Drawing.Image"

file = "C:/test.jpg"

lv.View = (dotNetClass "System.Windows.Forms.View").LargeIcon
for x = 0 to 10 do
item=dotNetObject "System.Windows.Forms.ListViewItem" "testItem"
imageList.images.add (imageClass.Fromfile file)
append items item

lv.items.addrange items
lv.LargeImageList = imageList

on roller open do
initImageView imageView

createDialog roller

For some reason icons aren't displayed. Propably just some small error I can't see :wip:

EDIT: I added imageindex for item and now everything works like a charm... :)

CGTalk Moderation
08-25-2009, 05:56 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.