-
September 17th, 2009, 01:18 AM
#1
insert a image in the ImageList at the perticular index
i have a Listview and in Listview i set the items with the corresponding images and my problem is to replace the perticular item's image , i have to implement Microsoft Windows like architecture in which some folder like Windows have My Computer,My Document etc,so i have made example like the Windows plateform ,my code for the listview is
ImageList img = new ImageList();
imageList.Images.Add("w",Image.FromFile("C:\\Folder.jpg"));
imageList.Images.Add("w",Image.FromFile("C:\\Folder.jpg"));
imageList.Images.Add("w",Image.FromFile("C:\\Folder.jpg"));
imageList.ImageSize = new System.Drawing.Size(30, 40);
listView1.LargeImageList = imageList;
//listView1.LargeImageList.ImageSize = new Size(50,50);
ListViewItem item1 = new ListViewItem("My Computer");
item1.ImageIndex = 0;
ListViewItem item2 = new ListViewItem("My Document");
item2.ImageIndex = 2;
ListViewItem item3 = new ListViewItem("Recycle bin");
item3.ImageIndex = 1;
// Add the items to the ListView.
listView1.Items.AddRange(new ListViewItem[] { item1, item2, item3 });
//listView1.Location = new System.Drawing.Point(6, 15);
//listView1.Name = "lstDPView";
//listView1.Size = new System.Drawing.Size(500, 500);
listView1.ShowItemToolTips = true;
listView1.TabIndex = 0;
//listView1.View = new Size(400, 200);
// listView1.UseCompatibleStateImageBehavior = true;
// listView1.View = View.Tile;
listView1.LabelEdit = true;
Now after that i have attached context menu with the listview,at context menu i have a menuitem name "SHARING" in after clicking that menuitem my perticular listview item images changes not all the items image changes,i think now you can understand my problem,if you have any question please ask me,i have to solve this problem urgently
:-(
Tags for this Thread
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
|