Solved

Loading an Image from a TImageList object to TImage

Posted on 2002-05-12
7
580 Views
Last Modified: 2008-01-16
Hi you all,

I have built a TImageList that contains several Icons, now what I need to do is, to draw them dynamicaly on the form, and that they could be dynamicaly changed (for examle an icon of a led that comes on and off).
What I thought would serve the purpose was to build TImages and connect them to the TImageList.
But , allas , I can't find the property that holds the handle to the Image list I have built.

Thanx in advance.
Zvi.
0
Comment
Question by:zvi_kleiner
7 Comments
 
LVL 2

Expert Comment

by:Tasomia
ID: 7004358
Hi,

Try this:

Image1.Picture := ImageList1.GetImage(1);
0
 

Author Comment

by:zvi_kleiner
ID: 7004387
Hi, Tasomia.
There is no such function as get Image, only GetImageBitMap, and that does not do the work.
If I use the Picture property, I need to use a function that'll return a TPicture or a handle to one.
0
 
LVL 4

Expert Comment

by:nestorua
ID: 7004403
HI,
You can Add and Insert methods of TImageList to add and insert
new images (TBitMap).
You can use GetBitmap method to get the required image from your ImageList.
Maybe I didn't understand exactly what the problem?
Sincerely,
Nestorua.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Expert Comment

by:RUSTAM
ID: 7005327
Hi.
TImageList have also Draw method. You can draw icon from TImageList direct on canvas.
0
 
LVL 17

Accepted Solution

by:
geobul earned 100 total points
ID: 7005329
Hi,

var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create;
  try
    ImageList1.GetBitmap(1, bmp);
    Image1.Picture.Bitmap.Assign(bmp);
  finally
    bmp.Free;
  end;
end;

Regards, Geo
0
 

Author Comment

by:zvi_kleiner
ID: 7005677
I will try all your proposals later today,
but I remeber I used (a year ago) some property of either TImageList or TImage that made a kind of "connection" between them (I think I gave the TImage object the name or a handle of the TImageList object).

I'll be more specific in about 5 hours.

Thank you all.
0
 

Author Comment

by:zvi_kleiner
ID: 7006695
Sorry Rustam, but geobul was more accurate.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, MySQL Query 4 164
Intraweb download file link ? 1 153
QRReport  TQrmemo vertical stretching 1 52
firemonkey Android Listview Sort items 7 47
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question