Problem in setting icon to TreeView Control
-
Hello Friends From 2 days ago i'm trying to show icons for treeview nodes programmatically. but i was failed. I have an ImageList with 2 16*16 icons. I have a TreeView Control too. I'm writing codes like below and I can see nodes, But i can't see any icon, I searched so many references in WebPages,but they confused me.
treeView1.ImageList = imageList1; for (int i = 0; i < 4; ++i) { TreeNode n = new TreeNode("Node with image " + i.ToString()); n.ImageIndex = 0; n.SelectedImageIndex = 1; treeView1.Nodes.Add(n); }
Please help me. Thank You. -- modified at 5:12 Sunday 30th April, 2006 -
Hello Friends From 2 days ago i'm trying to show icons for treeview nodes programmatically. but i was failed. I have an ImageList with 2 16*16 icons. I have a TreeView Control too. I'm writing codes like below and I can see nodes, But i can't see any icon, I searched so many references in WebPages,but they confused me.
treeView1.ImageList = imageList1; for (int i = 0; i < 4; ++i) { TreeNode n = new TreeNode("Node with image " + i.ToString()); n.ImageIndex = 0; n.SelectedImageIndex = 1; treeView1.Nodes.Add(n); }
Please help me. Thank You. -- modified at 5:12 Sunday 30th April, 2006I checked your code .You must fix the line number 4 from
n.SelectedImageIndex = 4;
ton.SelectedImageIndex = 1;
because your image list has only two images and the treeview can't display image for selected node DevIntelligence.com - My blog for .Net Developers -
I checked your code .You must fix the line number 4 from
n.SelectedImageIndex = 4;
ton.SelectedImageIndex = 1;
because your image list has only two images and the treeview can't display image for selected node DevIntelligence.com - My blog for .Net DevelopersHello again Ok, I saw that and that was not the main problem, beacause i just typed wrong imageindex here and in my project it was correct. Thank you for your advice.
-
Hello again Ok, I saw that and that was not the main problem, beacause i just typed wrong imageindex here and in my project it was correct. Thank you for your advice.
-
Hello Friends From 2 days ago i'm trying to show icons for treeview nodes programmatically. but i was failed. I have an ImageList with 2 16*16 icons. I have a TreeView Control too. I'm writing codes like below and I can see nodes, But i can't see any icon, I searched so many references in WebPages,but they confused me.
treeView1.ImageList = imageList1; for (int i = 0; i < 4; ++i) { TreeNode n = new TreeNode("Node with image " + i.ToString()); n.ImageIndex = 0; n.SelectedImageIndex = 1; treeView1.Nodes.Add(n); }
Please help me. Thank You. -- modified at 5:12 Sunday 30th April, 2006Does
imageList1
actually contain the images? Does setting the property using the Forms Editor work? Regards Senthil _____________________________ My Blog | My Articles | My Flickr | WinMacro -
Does
imageList1
actually contain the images? Does setting the property using the Forms Editor work? Regards Senthil _____________________________ My Blog | My Articles | My Flickr | WinMacroHello Everything is Ok, I have imagelist with icons (*.png,*.ico) and i set imagelist property of TreeView control. I have no problem in wizard mode. It means when i add and set nodes and icons from properties window there is no problem. Problem accures in programmatically mode. I think i have problem with pictures size or type, Can yo help me ?