473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Treenode Images

Anyone out there today? Happy Thanksgiving!

I am writing a Window app that has a TreeView control. I am creating the
nodes dynamically from an XML file, and I have some icon images that I have
associated with each of the "top" nodes. The users, after some usability
testing, have decided they don't want the "child" nodes to have any icons
associated.

I cannot seem to get the child nodes to NOT have an icon. I have tried
changing the index of the ImageControl the nodes are pointing to to a -1,
commenting out the assignment, etc. but they end up using the image at index
0. Here's the relevent code:

//...switch statement above this to figure out which icon index to put in
currentIcon
tempSysNode.ImageIndex = currentIcon;
sysTree.Nodes.Add(tempSysNode);
node = tempSysNode;
categoryIdentifier = tempSysInfo.systemName;
}

// Add SubSystem nodes to the TreeView, under their respective System name

currentIcon = -1; //One of the many tests
TreeNode tempSubsysNode = new TreeNode(tempSysInfo.subsystemName);
tempSubsysNode.Tag = tempSysInfo.ID;
//tempSubsysNode.ImageIndex = currentIcon; //I'VE TRIED COMMENTING THIS OUT
BUT IT DEFAULTS TO INDEX 0 WHEN I DO
node.Nodes.Add(tempSubsysNode);
DataRow newRow = systemsDataSet.Tables[0].NewRow();

//More code to figure out if there are any grandchild nodes

How do I eliminate the icons for all of the child, grandchild, etc. nodes?

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
Nov 20 '06 #1
3 11491
Just create a blank icon and stick it in your image list.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp

"WhiteWizard" <Wh*********@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
Anyone out there today? Happy Thanksgiving!

I am writing a Window app that has a TreeView control. I am creating the
nodes dynamically from an XML file, and I have some icon images that I
have
associated with each of the "top" nodes. The users, after some usability
testing, have decided they don't want the "child" nodes to have any icons
associated.

I cannot seem to get the child nodes to NOT have an icon. I have tried
changing the index of the ImageControl the nodes are pointing to to a -1,
commenting out the assignment, etc. but they end up using the image at
index
0. Here's the relevent code:

//...switch statement above this to figure out which icon index to put in
currentIcon
tempSysNode.ImageIndex = currentIcon;
sysTree.Nodes.Add(tempSysNode);
node = tempSysNode;
categoryIdentifier = tempSysInfo.systemName;
}

// Add SubSystem nodes to the TreeView, under their respective System name

currentIcon = -1; //One of the many tests
TreeNode tempSubsysNode = new TreeNode(tempSysInfo.subsystemName);
tempSubsysNode.Tag = tempSysInfo.ID;
//tempSubsysNode.ImageIndex = currentIcon; //I'VE TRIED COMMENTING THIS
OUT
BUT IT DEFAULTS TO INDEX 0 WHEN I DO
node.Nodes.Add(tempSubsysNode);
DataRow newRow = systemsDataSet.Tables[0].NewRow();

//More code to figure out if there are any grandchild nodes

How do I eliminate the icons for all of the child, grandchild, etc. nodes?

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT

Nov 20 '06 #2
Thanks Robbe but that ends up leaving a icon sized blank space after the +
but before the text. One of the reasons for taking the icons out is to
shorten that text so not so much of it goes behind the splitter we have on
the form.

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
"Robbe Morris [C# MVP]" wrote:
Just create a blank icon and stick it in your image list.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp

"WhiteWizard" <Wh*********@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
Anyone out there today? Happy Thanksgiving!

I am writing a Window app that has a TreeView control. I am creating the
nodes dynamically from an XML file, and I have some icon images that I
have
associated with each of the "top" nodes. The users, after some usability
testing, have decided they don't want the "child" nodes to have any icons
associated.

I cannot seem to get the child nodes to NOT have an icon. I have tried
changing the index of the ImageControl the nodes are pointing to to a -1,
commenting out the assignment, etc. but they end up using the image at
index
0. Here's the relevent code:

//...switch statement above this to figure out which icon index to put in
currentIcon
tempSysNode.ImageIndex = currentIcon;
sysTree.Nodes.Add(tempSysNode);
node = tempSysNode;
categoryIdentifier = tempSysInfo.systemName;
}

// Add SubSystem nodes to the TreeView, under their respective System name

currentIcon = -1; //One of the many tests
TreeNode tempSubsysNode = new TreeNode(tempSysInfo.subsystemName);
tempSubsysNode.Tag = tempSysInfo.ID;
//tempSubsysNode.ImageIndex = currentIcon; //I'VE TRIED COMMENTING THIS
OUT
BUT IT DEFAULTS TO INDEX 0 WHEN I DO
node.Nodes.Add(tempSubsysNode);
DataRow newRow = systemsDataSet.Tables[0].NewRow();

//More code to figure out if there are any grandchild nodes

How do I eliminate the icons for all of the child, grandchild, etc. nodes?

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT


Nov 20 '06 #3
If memory serves me correctly, the tree is going to
render that way in order to line things up.
I don't recall the build in .net TreeView supporting
the concept of some nodes having icons and
some don't.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp

"WhiteWizard" <Wh*********@discussions.microsoft.comwrote in message
news:09**********************************@microsof t.com...
Thanks Robbe but that ends up leaving a icon sized blank space after the +
but before the text. One of the reasons for taking the icons out is to
shorten that text so not so much of it goes behind the splitter we have
on
the form.

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
"Robbe Morris [C# MVP]" wrote:
>Just create a blank icon and stick it in your image list.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp

"WhiteWizard" <Wh*********@discussions.microsoft.comwrote in message
news:E6**********************************@microso ft.com...
Anyone out there today? Happy Thanksgiving!

I am writing a Window app that has a TreeView control. I am creating
the
nodes dynamically from an XML file, and I have some icon images that I
have
associated with each of the "top" nodes. The users, after some
usability
testing, have decided they don't want the "child" nodes to have any
icons
associated.

I cannot seem to get the child nodes to NOT have an icon. I have tried
changing the index of the ImageControl the nodes are pointing to to
a -1,
commenting out the assignment, etc. but they end up using the image at
index
0. Here's the relevent code:

//...switch statement above this to figure out which icon index to put
in
currentIcon
tempSysNode.ImageIndex = currentIcon;
sysTree.Nodes.Add(tempSysNode);
node = tempSysNode;
categoryIdentifier = tempSysInfo.systemName;
}

// Add SubSystem nodes to the TreeView, under their respective System
name

currentIcon = -1; //One of the many tests
TreeNode tempSubsysNode = new TreeNode(tempSysInfo.subsystemName);
tempSubsysNode.Tag = tempSysInfo.ID;
//tempSubsysNode.ImageIndex = currentIcon; //I'VE TRIED COMMENTING
THIS
OUT
BUT IT DEFAULTS TO INDEX 0 WHEN I DO
node.Nodes.Add(tempSubsysNode);
DataRow newRow = systemsDataSet.Tables[0].NewRow();

//More code to figure out if there are any grandchild nodes

How do I eliminate the icons for all of the child, grandchild, etc.
nodes?

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT



Nov 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Andrew | last post by:
created a custom class that is derived from TreeNode, let's call it customTreeNode. I'm trying to use the TreeViewEventArgs (for the AfterSelect event) but I cannot cast to my derived TreeNode. ...
1
by: Abdessamad Belangour | last post by:
Hi all, I have a Windows Form class containing a treeView control. I have another class HierarchyDocument that creates a hierarchy of treeNodes and has a method (createHierarchy) that returns...
5
by: SeanT | last post by:
Greetings and salutations! I am having a real issue with the VB.NET TreeView control. I need to display an image (a.k.a. logo, picture, etc) from a file as the treenode object. I can not seem to...
5
by: Bob | last post by:
Hi, I have a treeview which contains nodes of a class (classA) derived from treenode. These classA nodes may contain nodes of a class (ClassB) derived from classA. The form load populates a...
2
by: Mark Jerde | last post by:
VS .NET 2003, Googling, msdn searching not successful. I'm using the images of nodes of a TreeView to show the Pass/Fail results of several tests. The tests are a little slow so I would like to...
0
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. ...
1
by: jmDesktop | last post by:
I am trying to add nodes with keys to my treeview. I can add general nodes without problem with: //create new node TreeNode newNode = new TreeNode(myIdNumber); //create children TreeNode...
1
by: AAaron123 | last post by:
If you see this posted twice - sorry. My news reader showed my first post as "No Longer Available" I have the following in a .css file. The treeNodes behave as if they were "a" elements. ...
0
by: Tom | last post by:
I have your classic WinForm treeview that uses an image list with 2 images: 1. An open folder. 2. A closed folder. The events that I have registered for are: 1. afterselect 2. afterexpand...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.