-
February 9th, 2007, 07:05 AM
#1
Avoiding the display of an image on treeview node
Hello,
i work under the following environment: WinXP, CSharpDevelop under .NET 2.0.
Problem description:
To simplify it, I'm trying to make a single node on a treeView. The treeview is linked to an imageList which contains some images. I wanted to show the treeview node without images. It seems not to be working in design time and in runtime.
The code is as follow:
Code:
node = new TreeNode(strValue);
node.Tag = "BTN" + intNextNode.ToString()+";0;;";
tV.Nodes.Add(node);
node.ImageIndex = -2;
node.SelectedImageIndex = -2;
The result is always the same, it shows the first item of the imageList when nothing is selected and no image when the node is selected.
How do i do to have this node without images?
Thx for your patience.
-
February 9th, 2007, 08:57 AM
#2
Re: Avoiding the display of an image on treeview node
Hmm ... it seems that an underflow value isn't working , it will always choose the first picture in the image collection . Try instead an overflow index .
Code:
node.ImageIndex = 200;
node.SelectedImageIndex = 200;
where I supposed you don't have 200 pictures in the collection
Bogdan
If someone helped you then please Rate his post and mark the thread as Resolved
Please improve your messages appearance by using tags [ code] Place your code here [ /code]
-
February 9th, 2007, 10:00 AM
#3
Re: Avoiding the display of an image on treeview node
I used an underflow value because it is how it was generate in the *.Designer.cs when i add a node manually, giving the 2 proprieties, ImageIndex and SelectedImageIndex, the value of "(NONE)".
In this case, the image displayed was the first image added to the imageList object.
With your suggestion, the node displays the last image added to the imageList object.
Maybe i should load a transparent gif as first image...
I just thought there was a way...
Thx for your suggestion!
-
February 9th, 2007, 01:17 PM
#4
Re: Avoiding the display of an image on treeview node
Not completly satisfactory, but adding a transparent picture to the imageList previous to all other images solves the problems.
-
February 9th, 2007, 01:25 PM
#5
Re: Avoiding the display of an image on treeview node
I used the overflow value and worked on my machine
Bogdan
If someone helped you then please Rate his post and mark the thread as Resolved
Please improve your messages appearance by using tags [ code] Place your code here [ /code]
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
|