-
August 15th, 2009, 08:56 PM
#1
Adding Icon to Listview
Hello ,
hello I need to set a different PNG image (with transparency ) from file for every item I add in a listview
I tried to add the items as follows
listViewUsers.Items.Add();
but it provides imageindex rather than Icon or Image as param... ()
Since, I have my image for each item on disk.. so I was hoping to add the items in the list by creating listviewitem and then adding image to it and then adding this to listview..
ListViewItem lvItem = new ListViewItem()
// set lvitem's name etc
//load my image from file
myImage = new Bitmap(@"image path here");
// but ImageList is null at this point ??? I dont understand whats going on..
lvItem.ImageList.Images.Add(myImage);
this.listViewUsers.Items.Add(lvItem);
Please help, this might be a very basic thing but I havent worked on C# before
thanks,
Ahmed
Last edited by xs2ahmed; August 15th, 2009 at 09:01 PM.
He is not strong and powerful, who throws people down, but he is strong who withholds himself from anger
MyWeb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
On-Demand Webinars (sponsored)
|