Sign in to follow this  

Delphi DirectX: how to load files to DXImageList???

This topic is 3862 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

Hiya Folks, Quick question for you... I have a string array holding the names of many Bmps/Jpegs. I want the user to be able to select which files they want loaded into a DXImageList (I'll just use a simple checkbox group for the selection). Can you tell me how to load/add these files to the DXImageList at runtime please? Much thanks, Jim [Edited by - Jim_U on May 22, 2007 10:00:21 AM]

Share this post


Link to post
Share on other sites

Ok, so not the quickest question after all!..but I still can't find a way to do this. The program works great if I load files into the imagelist before running it, so it's REALLY bugging me now! Please help!

Jim

Share this post


Link to post
Share on other sites
From here: http://members.fortunecity.com/flegelsite/

2.1   Loading pictures at runtime



// Load a normal raster-image into DXImageList (BMP, DIB etc.)

// Picture becomes an item of DXImageList

procedure LoadImage (Filename, NameImage : String; PatWidth, PatHeight : Integer;

Transp : Boolean; TranspColor : TColor);

begin

DXImageList.Items.Add;

with DXImageList.Items[DXImageList.Items.Count-1] do

begin

Picture.LoadFromFile (FileName);

Name := NameImage;

PatternWidth := PatWidth;

PatternHeight := PatHeight;

SkipHeight := 0;

SkipWidth := 0;

SystemMemory := False;

Transparent := Transp;

TransparentColor := TranspColor;

Restore;

end;

end;



With this method, I can load about 200 pictures at a time with no problems. More pictures give problems, just because of the limits of my

physical memory J. Loading jpeg-pictures however, always give problems! Only BMP and DIB pictures work well.


That Restore might be the most important.

Unfortunately, it's been years since I've encountered Delphi, so I can't test it.

Share this post


Link to post
Share on other sites

This topic is 3862 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this