Archived

This topic is now archived and is closed to further replies.

TheSisko

changing the Image.Picture property to...

Recommended Posts

I''m creating some games, and I have this button, which allows you to change the difficulty of the make. No problem with that. Every time the user clicks that button, the .picture property is changed to display a picture that contains a text like: ''I can have more!''. I have 5 different TImages for that, plus one to actually DISPLAY the picture, the other five aren''t visible. Now, I thought, wouldn''t it be nice if I could store those 5 pics in a TImageList? So I put them in an ImageList, but now how do I get the TImage that''s left to display a certain Image that''s in the TImageList?

Share this post


Link to post
Share on other sites
Hi there,

heres the code - simple realy

var
oBitmap: TBitmap;
begin
//Create and initialize temporary bitmap
oBitmap := TBitmap.Create;
oBitmap.Width := ImageList1.Width;
oBitmap.Height := ImageList1.Height;

//Draw image list item to bitmap
ImageList1.Draw(oBitmap.Canvas,0,0,0);

//Copy temporary bitmap to image component
Image1.Picture.Assign(oBitmap);

//Free temporary bitmap object
oBitmap.Free;
end;

Mark

Share this post


Link to post
Share on other sites