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

How to use imageList

Can anybody send how to use imageList tool? How can we extract the pictures one by one?



Thank you
Aug 1 '09 #1
4 26910
cloud255
427 Expert 256MB
Hi

What exactly do you mean by extract?
To address a specific image you can use the key of the image:

Expand|Select|Wrap|Line Numbers
  1. myImageList.Images["ImageKey"]
or find it by its index. I suggest supplying a key to each image you add to the ImageList as this makes the code more maintainable.
Aug 1 '09 #2
i mean how we can view the images from imageList?is it possible to add the images to a picture box one by one?
Aug 2 '09 #3
ThatThatGuy
449 Expert 256MB
hi !!!

First drag and drop imageList control from your ToolBox to the form...
Go to the imagelist properties...and in there select Images property....select a few images.....
Set the ColorDepth Property to Depth32Bit..
this property determines the color resolution of your images...
Set the ImageSize property to the picture Box size.....
Put up a button in your form and a picture box too...
Declare a global variable such as int i=0;
Now Put up this code into thr button click event
Expand|Select|Wrap|Line Numbers
  1.  if (i < imageList1.Images.Count)
  2.             {
  3.                 pictureBox1.Image = imageList1.Images[i];
  4.                 i++;
  5.             }
  6.             else
  7.             {
  8.                 i = 0;
  9.             }
  10.  
this code will show images one by one in the image list.....and will keep revolving.......
Aug 3 '09 #4
ThatThatGuy was very helpful. It's amazing how hard it is to find a simple answer to this obvious question. Us VB6 guys new to C# .NET probably screw up by trying to use:

pictureBox1.Image = imageList1.Images("MyImageName");

That's how it looks in VB6, but here is how it looks in C# .NET (using BMPs imported into the imagelist):

pictureBox1.Image = imageList1.Images["MyImageName.bmp"]

There is no '.Item' member on the collection to let you use "()" instead of "[]" and the ".bmp" gets automatically included with the filename as the key. So simple! But all the examples are just loading images off the disc to the image list and/or getting the graphics object off the WinForm and drawing the image to that.
Nov 21 '10 #5

Sign in to post your reply or Sign up for a free account.

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: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and...
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: 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
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:
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
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...
0
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,...
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...

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.