473,473 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ImageList Component -- baffling behavior

(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 set the TreeView ImageList
property to the ImageList component and observe the expected results in the TreeView
as displayed in the IDE. However, this simple example will not compile and run. It
throws an unhandled exception in the Form's designer code, both in VB and C#.

2) Remove the TreeView leaving the ImageList with one image. The example will still
not compile and run - has same exception.

The designer has tree lines of code for the ImageList:
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resource s.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "folder_16.ico");

The exception occurs on the third line (SetKeyName), the exception being "Index out
of Range". Examining imageList1.Images properties at that point shows an image
count of 0 which explains the exception, but I do not know why the "count" is 0.
In VB, rather than using the ImageList component, I found that creating the ImageList
at runtime for the TreeView works as expected. Now in C# when I try this approach,
the icon in the treeview displays about only about 50% of the time when the form is
loaded, otherwise the icon is not being painted the rest of the times.

Spending a couple of hours on google turned up nothing.

Does anyone have any idea as to what might be going on here?
Thanks,

Gene
Mar 7 '07 #1
0 2416

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

Similar topics

0
by: MB | last post by:
Hi a guys 02 questions a bout imageList please help me if you have an idea 1) I have a strange probleme with imageList, I added some images at designtime and I can see the images but at...
0
by: alex n | last post by:
hello. it was fine to have system image list class/component in C++/Delphi in old times. you can obtain just image index for file with shell and your list/treeview already draw file icon. but...
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: Xarky | last post by:
Hi, I am writing a windows application. To my form I have added a ToolBar componenet and have created a collection of buttons within it. I have also created an ImageList, where I have loaded the...
6
by: Stephen Costanzo | last post by:
In the code below I receive an exception error because the target file is being used by another process. I know this to be false because the target doesn't exist. It seems like the application...
5
by: Vittorio Pavesi | last post by:
Hello, I'm experiencing error displaying PNG images with transparent background using ImageList; the picture is displayed in a wrong way. Picturebox doesn't seem to be affected by this problem. I...
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....
2
by: senfo | last post by:
I'm using a ListView control to display pictures similarly to how Windows Explorer displays pictures in "Thumbnails" view. The images are stored in an ImageList component. I would like to provide...
2
by: senfo | last post by:
I'm using an ImageList component in conjunction with a ListView control to display images and it appears as though it's only possible set the size of an image globally, for the entire list. Is...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
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...
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...
0
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...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.