473,396 Members | 1,655 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,396 software developers and data experts.

Understanding ImageList

If I add an image to an imagelist using

imageList.Images.Add...

And want to use it with a tree node

tn.ImageIndex = imageIndex

How do I know what to set imageIndex to?

If I want to add Images to an ImageList in some random fashion, say item 2,
then 0, then 1. How do I do that?

Thanks for any help
Nov 20 '05 #1
2 1239

" Just Me" <ne********@a-znet.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
If I add an image to an imagelist using

imageList.Images.Add...

And want to use it with a tree node

tn.ImageIndex = imageIndex

How do I know what to set imageIndex to?
tn.ImageIndex = imageList.Images.Count-1

or

tn.ImageIndex = imageList.Images.IndexOf(myImage)
If I want to add Images to an ImageList in some random fashion, say item 2, then 0, then 1. How do I do that?


You will need to add a bunch of dummy to fill the collection to the desired
size and then replace those with the images in question. However it sounds
like you'd be using the collection incorrectly. Why is the order important?

Richard

Nov 20 '05 #2
> > How do I know what to set imageIndex to?
tn.ImageIndex = imageList.Images.Count-1 This is what I do

tn.ImageIndex = imageList.Images.IndexOf(myImage)

But I realized I didn't know a general way, like this
But is myimage simply the Icon I added to the list???
THANKS

If I want to add Images to an ImageList in some random fashion


Using it with a TreeView for a Windows Explorer like app. Each time I open
a directory I get the icons for the files and add them to the Imaglist.
However, I don't like the idea that the list keeps growing. If myimage above
is really just the icon I can use the above to see if it is already in the
list. Comment?

Does the imagelist actually stores the image?

If so, do you think it has to compare the bits to find the index given an
icon?

Thanks again
Nov 20 '05 #3

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

Similar topics

2
by: A. Solomon | last post by:
Hi, I have a ImageList containing 4 bitmaps attached to a UserControl which acts as a Open/Close panel. This panel, upon click, switches the image in a PictureBox control to indicate the...
2
by: Bob C. | last post by:
Hi All, I am using the ImageList/ListView Components to display around 100 images in C#.NET. The issue i have is, some times i may need to display the thumbnail of size more then 256x256 in...
2
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error...
7
by: Andrew Christiansen | last post by:
Hey everyone. I have Visual Basic .NET 2003 and am trying to show images on a treeview control. I have the imagelist on the form filled with images, and have the ImageList property of the...
4
by: Just Me | last post by:
If I add an image to an imagelist using imageList.Images.Add... And use it with a tree node tn.ImageIndex = imageList.Images.Count-1 This is the actual code:...
0
by: Andre Viens | last post by:
Hello, I am using the following variation of code from <http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340> to add icons to an imagelist for use in a listview: Private Structure...
6
by: henrycortezwu | last post by:
Hi, I have a WinXPSP2, P4 3.2GHZ, 1GIG RAM on my dev machine using VS2005 VB.NET. I did the following procedure: 1. Added 82 icons (128x128 in size & 32bit Depth) in an imagelist control 2....
0
by: gene kelley | last post by:
(using VS2005) I want to add an icon to TreeView nodes. 1) To a new project (VB or C#) I add a sample TreeView with some sample nodes. I add an ImageList component, and add one icon image. I...
2
by: =?Utf-8?B?S2VuTg==?= | last post by:
We're using a System.Windows.Forms.ImageList to store a bunch of Images that I've loaded, and rendering each image in the ImageList during a draw loop. The process was running unusually slow and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.