Results 1 to 5 of 5

Thread: UnDelphiX: Filling DXImageList at runtime

  1. #1

    UnDelphiX: Filling DXImageList at runtime

    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?

  2. #2
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    UnDelphiX: Filling DXImageList at runtime

    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)

  3. #3

    UnDelphiX: Filling DXImageList at runtime

    but creating this DXG file is kinda difficult, isn't it?

  4. #4

    UnDelphiX: Filling DXImageList at runtime

    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]

  5. #5

    UnDelphiX: Filling DXImageList at runtime

    Thank you very much!
    Merry Chrismas!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •