We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Treeview node images

How can I set the treenode images to whatever I want. I can set the curent image of a node using. nod.LeftImageIndices = new int[] {41}; //closed folder. Most other constrols use image lists and an image index to specify the image for a control, is there something similar. Or something to set the image using a file eg. nod.image = "test.ico";

4 Replies

AD Administrator Syncfusion Team November 11, 2004 10:56 PM UTC

Hi Rich, We do not have an "Form.Icon" like property associated with the TreeNodeAdv, but you could use the following approach if you wish to directly assign image files to the TreeNodeAdvs : Bitmap bmp1 = new Bitmap("..\\..\\shape9.ico"); Bitmap bmp2 = new Bitmap("..\\..\\shape10.ico"); Bitmap bmp3 = new Bitmap("..\\..\\shape11.ico"); Bitmap bmp4 = new Bitmap("..\\..\\shape12.ico"); Bitmap bmp5 = new Bitmap("..\\..\\shape13.ico"); this.imageList1.Images.Add(bmp1); this.imageList1.Images.Add(bmp2); this.imageList1.Images.Add(bmp3); this.imageList1.Images.Add(bmp4); this.imageList1.Images.Add(bmp5); int count=0; foreach (TreeNodeAdv node in this.treeViewAdv1.Nodes) { node.LeftImageIndices = new int[] {count}; node.RightImageIndices = new int[] {count}; count++; } Please refer to the test sample attached here and let me know if this meets your requirements. Thanks for your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


RI Richard November 12, 2004 02:06 AM UTC

Thanks Guru, this will do nicely


BR Bill Rhodes June 5, 2008 07:08 AM UTC

Hey how can I do this for the asp.net tree?

>Thanks Guru, this will do nicely



MW Melba Winshia Syncfusion Team June 6, 2008 12:13 PM UTC

Hi Billy,

If your intention is to set images to the TreeNode of Syncfusion asp.net Treeview control, then please refer below link to get more details on this issue:

http://www2.syncfusion.com/ug_63/toolsweb/ImageSettings.html

And also, please refer the below sample:

http://www2.syncfusion.com/samplebrowser/tools.web/samples/2.0/treepackage/treeview-%20basic%20features/nodecheckboxes/cs/NodeCheckBoxes.aspx

Please try this and let me know if this helps.

Thanks,
Melba



Loader.
Live Chat Icon For mobile
Up arrow icon