Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to assign image from imagelist to Timage/TPicture?

6,532 views
Skip to first unread message

Markus Humm

unread,
Sep 27, 2004, 5:51:47 AM9/27/04
to
Hello,

I'm using Delphi 7 prof. and have some images in an imagelist which
already "feeds" my toolbar. But now I have also some TImages in one form
which should display some of the images from the imagelist.

How is this done? Is this possible, or MUST these pictures come from
files rather than an image list (which would seem unlogically to me)?

Greetings

Markus

Alexander Nagumanov

unread,
Sep 27, 2004, 6:37:24 AM9/27/04
to

This example assigns a bitmap contained in an ImageList to an Image
component's Picture's Bitmap property and displays the bitmap.

procedure Form1.Button1Click(Sender: TObject);
begin
ImageList1.GetBitmap(0,Image1.Picture.Bitmap);
end;

Markus Humm

unread,
Sep 27, 2004, 12:28:21 PM9/27/04
to
[snip]

I'll try it. Thanks!

Markus

Markus Humm

unread,
Sep 27, 2004, 1:19:28 PM9/27/04
to
It worked, but now I've got another problem with it:

my image list formerly contained little pictures for the buttons
(Borland Standard). All have the same size, but my new ones are bigger.
When I import them to the image list, I only have the posibility to cut,
stretch or center them, but I can't keep the original size. They get
either cut at one place or get shrinked. How to avoid this?

Greetings

Markus

Alexander Nagumanov

unread,
Sep 28, 2004, 12:29:32 AM9/28/04
to
> my image list formerly contained little pictures for the buttons (Borland
> Standard). All have the same size, but my new ones are bigger. When I
> import them to the image list, I only have the posibility to cut, stretch
> or center them, but I can't keep the original size. They get either cut at
> one place or get shrinked. How to avoid this?

You have to use another ImageList for yours big pictures, becouse all
pictures within it has same Height and Width.
See TImageList.Height and TImageList.Width descriptions in Delphi Help

Markus Humm

unread,
Sep 28, 2004, 3:11:58 AM9/28/04
to
>
> You have to use another ImageList for yours big pictures, becouse all
> pictures within it has same Height and Width.
> See TImageList.Height and TImageList.Width descriptions in Delphi Help

Oh. Okay, nothing easier than that...

Greetings

Markus

0 new messages