Jump to content
  • Advertisement

Archived

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

TheSisko

changing the Image.Picture property to...

This topic is 6106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!