Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > Using imagelists with Treeviews


Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2001, 05:59 PM
gfroese
Guest
 
Posts: n/a
Default Using imagelists with Treeviews


I'm trying to use an imagelist to display an icon for each node in a treeview. I can load the treeview with the images fine, but they are all the same image, index 1. and when I go back to dev and look at my imagelist, they are all the same image as image 1. I am loading 6 different images, but they are all becoming the same one. The images are all the same size.

any help here appreciated.

Reply With Quote
  #2  
Old 05-08-2001, 07:32 AM
anhmytran anhmytran is offline
Senior Contributor

Retired Moderator
* Guru *
 
Join Date: Aug 1999
Location: Hartford, Connecticut, 06
Posts: 1,487
Default Re: Using imagelists with Treeviews

It is not true that you are "loading 6 different images, but they are all
becoming the same one." When you "load" you actually click the
"Insert Picture" button, and you always see all images during
the time you "insert" them one by one. If you use the word
"Load" and "go back" you are doing wrongly.
The correct words are "insert picture"
and "always seeing them in the mean time."

It is true, however, they must be the same size,
for Microsoft Online Help said so.

AnhMy_Tran<P ID="edit"><FONT class="small"><EM>Edited by anhmytran on 05/08/01 08:34 AM.</EM></FONT></P>
Reply With Quote
  #3  
Old 05-08-2001, 10:06 AM
gfroese
Guest
 
Posts: n/a
Default Re: Using imagelists with Treeviews

ok, so I am inserting 6 different pictures but they are all becoming the first one as soon as my program makes a call to the treeview using the imagelist. any ideas why?

(when I return to development and view the pictures in the imagelist, they are all the same)

Reply With Quote
  #4  
Old 05-08-2001, 11:25 AM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: Using imagelists with Treeviews

So to be clear, you are loading the pictures in the IDE environment by setting the imagelist properties? And at this time, you can see that all the images are different?

But when you run the program, all the images change? And when you stop the program and get back to the IDE, you see all the images are the same?



"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #5  
Old 05-08-2001, 11:25 AM
anhmytran anhmytran is offline
Senior Contributor

Retired Moderator
* Guru *
 
Join Date: Aug 1999
Location: Hartford, Connecticut, 06
Posts: 1,487
Default Re: Using imagelists with Treeviews

TreeView1.ImageList = ImageList1
With TreeView1
.Nodes.Add , , "T", "ATran", 1, 2
.Nodes.Add "Relative", tvwChild, "ItsOwnKey", "Image1Key", "Image2Key"
.Nodes.Add "Relative", tvwChild, "ItsOwnKey", 3, 4
End With

ItsOwnKey is the String to specify the Rank in the Relationship between Nodes.
ImageKey is the String you enter in the KEY in the Image Box Property
Number is the INDEX when you Insert Picture in the Image Box Property.
You can use either of them. When they are identical, the image is also identical.
Please, check your code to see if they are different?

AnhMy_Tran
Reply With Quote
  #6  
Old 05-09-2001, 07:03 AM
gfroese
Guest
 
Posts: n/a
Default Re: Using imagelists with Treeviews

I changed my treeview properties to no imagelist and then set the imagelist in the code and everything worked fine. Go figure, but thanks for the help.

Reply With Quote
  #7  
Old 05-09-2001, 07:35 AM
anhmytran anhmytran is offline
Senior Contributor

Retired Moderator
* Guru *
 
Join Date: Aug 1999
Location: Hartford, Connecticut, 06
Posts: 1,487
Default Re: Using imagelists with Treeviews

Dear:
I do not understand what you said and what you have done.
I am sorry that I cannot help you in a very small matter like that.
Have a nice day.

AnhMy_Tran
Reply With Quote
  #8  
Old 05-09-2001, 07:46 AM
gfroese
Guest
 
Posts: n/a
Default Re: Using imagelists with Treeviews

don't worry my friend, you have already helped me and I have my treeview working fine now, thank you

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->