none
How to assign animated gif image in tree node RRS feed

  • Question

  • suppose my treeview has many node and i am adding images to those node from image list. here is my code.

    private System.Windows.Forms.TreeView treeView1;
    ImageList il = new ImageList();
                il.Images.Add(new Icon("KEY04.ICO"));
                il.Images.Add(new Icon("ARW06LT.ICO"));
                il.Images.Add(new Icon("LITENING.ICO"));
                il.Images.Add(new Icon("ARW06UP.ICO"));
                treeView1.ImageList = il ; 
    
                // Create the RootNode
                TreeNode rootNode = treeView1.Nodes.Add("USA");
                rootNode.ImageIndex =0 ;
    
                // Create the Child nodes for the root
                TreeNode states1 = rootNode.Nodes.Add("New York");
                states1.ImageIndex =1 ;
                TreeNode states2 = rootNode.Nodes.Add("Michigan");
                states2.ImageIndex =1 ;
                TreeNode states3 = rootNode.Nodes.Add("Wisconsin");
                states3.ImageIndex =1 ;
                TreeNode states4 = rootNode.Nodes.Add("California");
                states4.ImageIndex =1 ;
    
                // Create siblings nodes for the Child nodes 
                TreeNode child = states1.Nodes.Add("Rochester");
                child.ImageIndex = 2 ;
                child =states1.Nodes.Add("new York");
                child.ImageIndex = 2 ;
                child =states1.Nodes.Add("Albany");
                child.ImageIndex = 2 ;
    
                child = states2.Nodes.Add("Detroit");
                child.ImageIndex = 2 ;
                child =states2.Nodes.Add("Ann Arbor");
                child.ImageIndex = 2 ;
                child =states2.Nodes.Add("Lansing");
                child.ImageIndex = 2 ;
    
                child = states3.Nodes.Add("Milwaukee");
                child.ImageIndex = 2 ;
                child =states3.Nodes.Add("Madison");
                child.ImageIndex = 2 ;
                child =states3.Nodes.Add("La Cross");
                child.ImageIndex = 2 ;
    
                child = states4.Nodes.Add("Los Angeles");
                child.ImageIndex = 2 ;
                child =states4.Nodes.Add("San Fransisco");
                child.ImageIndex = 2 ;
                child =states4.Nodes.Add("San Diego");
                child.ImageIndex = 2 ;

    i want to add animated gif icon at tree node instead of ico file. how can i do it. the most important part is animated gif image should play when i will run my apps. looking for best solution instead of developing custom treeview. thanks

    Tuesday, April 2, 2013 3:10 PM

Answers

All replies