Solved

Loading an Image from a TImageList object to TImage

Posted on 2002-05-12
7
582 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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 : could not find program, '...exe' 2 212
Printing problem 2 110
How to debug For loops? 3 60
TServerSocket - file via sendbuf or Text via sendtext ? 1 76
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

763 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