Hello,
does anybody konw how to fill the DXImageList on runtime?
I was possible to load pictures at the Form.OnCreate event,
but not later. Any ideas?
Hello,
does anybody konw how to fill the DXImageList on runtime?
I was possible to load pictures at the Form.OnCreate event,
but not later. Any ideas?
I use normal delphiX and use the DXG lists. These load fine during runtime. using a standard DXImageList.LoadfromFile call.
I have not tried loading single Images at run time.
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
but creating this DXG file is kinda difficult, isn't it?
To load an individual image at runtime, you can use something like this:
[pascal]
var
DIB: TDIB;
Item: TPictureCollectionItem;
fs: TFileStream;
...
Item := TPictureCollectionItem.Create(DXImageList.Items);
with Item do begin
PatternWidth := 64;
PatternHeight := 32;
SkipWidth := 0;
SkipHeight := 0;
SystemMemory := False;
Transparent := True;
TransparentColor := clFuschia;
DIB := TDIB.Create;
fs := TFileStream.Create('image.bmp');
DIB.LoadFromStream(fs);
Picture.Assign(DIB);
Restore;
fs.Free;
DIB.Free;
end;[/pascal]
That may not be the bast way to do it, though. You could load the patternwidth, etc. values from the stream as well.
To create a DXG file, you can use one of the utillities listed here, such as DXG Edit. This file can be loaded using DXImageList.LoadFromFile as cairnswm says. Note that loading a DXG file will clear any images already in the list.
[size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]
Thank you very much!
Merry Chrismas!
Bookmarks