Solved

Loading an Image from a TImageList object to TImage

Posted on 2002-05-12
7
577 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now