473,657 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Ima geIndex = currentIcon;
sysTree.Nodes.A dd(tempSysNode) ;
node = tempSysNode;
categoryIdentif ier = tempSysInfo.sys temName;
}

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

currentIcon = -1; //One of the many tests
TreeNode tempSubsysNode = new TreeNode(tempSy sInfo.subsystem Name);
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 11508
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

"WhiteWizar d" <Wh*********@di scussions.micro soft.comwrote in message
news:E6******** *************** ***********@mic rosoft.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.Ima geIndex = currentIcon;
sysTree.Nodes.A dd(tempSysNode) ;
node = tempSysNode;
categoryIdentif ier = tempSysInfo.sys temName;
}

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

currentIcon = -1; //One of the many tests
TreeNode tempSubsysNode = new TreeNode(tempSy sInfo.subsystem Name);
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

"WhiteWizar d" <Wh*********@di scussions.micro soft.comwrote in message
news:E6******** *************** ***********@mic rosoft.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.Ima geIndex = currentIcon;
sysTree.Nodes.A dd(tempSysNode) ;
node = tempSysNode;
categoryIdentif ier = tempSysInfo.sys temName;
}

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

currentIcon = -1; //One of the many tests
TreeNode tempSubsysNode = new TreeNode(tempSy sInfo.subsystem Name);
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

"WhiteWizar d" <Wh*********@di scussions.micro soft.comwrote in message
news:09******** *************** ***********@mic rosoft.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*********@di scussions.micro soft.comwrote in message
news:E6******* *************** ************@mi crosoft.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.Ima geIndex = currentIcon;
sysTree.Nodes.A dd(tempSysNode) ;
node = tempSysNode;
categoryIdentif ier = tempSysInfo.sys temName;
}

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

currentIcon = -1; //One of the many tests
TreeNode tempSubsysNode = new TreeNode(tempSy sInfo.subsystem Name);
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
6173
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. Here is a snip... ---code snip--- private void _TreeView_AfterSelect(object sender, TreeViewEventArgs e) { customTreeNode foo = (customTreeNode)e.Node; displayInfo(foo);
1
1418
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 a TreeNode object. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5
2492
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 find a way to do this in .NET. I have tried the DrawImageUnscaled and thought that was the way to go, but I was wrong. If anyone has any suggestions, please help! The code I have currently follows: Public Sub mTreeViewLoad(ByVal m_xmld As...
5
1703
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 imagelist and calls a subroutine that assigns an image to each node depending on its type. If I expand a classA node, all is well. ie. I see the classA image on the classA node and the classB image on the exposed classB node (which is always
2
13003
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 Refresh() between each test. This works: MyTreeView.Refresh(); .... but it causes a lot of flicker. The node text does not change. Only the TreeNode.ImageIndex changes.
0
3298
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. Provide following view properties to listview, through View menu a. Tile b. Icon
1
7372
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 myPersonNode = new TreeNode(myPerson); TreeNode myAddressNode = new TreeNode(myAddress);
1
3271
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. I can't get them to not respond to the mouse!
0
1530
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 3. aftercollapse The AfterExpand and AfterCollapse events set the imageindex appropriately,
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.