Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6169859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:55:45+00:00 2026-05-23T22:55:45+00:00

I have a table contains Image in a Picture field and I am going

  • 0

I have a table contains Image in a Picture field and I am going to put them into an ImageList.
Here is the code:

ImageList.Clear;
ItemsDts.First;
ImageBitmap:= TBitmap.Create;
try
  while not ItemsDts.Eof do
  begin
    if not ItemsDtsPicture.IsNull then
    begin
      ItemsDtsPicture.SaveToFile(TempFileBitmap);
      ImageBitmap.LoadFromFile(TempFileBitmap);
      ImageList.Add(ImageBitmap, nil);
    end;
    ItemsDts.Next;
  end;
finally
  ImageBitmap.Free;
end;

But I have some problem for images with difference size from ImageList size.

Update:
My problem is that when adding Image larger than ImageList size (32 * 32), for example 100 * 150 It does not appear correctly in a component connected to ImageList (for example in a ListView).
It seems newly added image is not stretched but is Croped. I want new image to be stretched as in ImageList Editor.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:55:46+00:00Added an answer on May 23, 2026 at 10:55 pm

    I don’t know if ImageList provides a property to automatically stretch the image. Unless someone finds some built-in, you can always stretch the image yourself before adding it to the ImageList. And while you’re at it, stop using the file-on-disk: use a TMemoryStream instead. Something like this:

    var StretchedBMP: TBitmap;
        MS: TMemoryStream;
    
    ImageList.Clear;
    ItemsDts.First;
    StretchedBMP := TBitmap.Create;
    try
    
      // Prepare the stretched bmp's size
      StretchedBMP.Width := ImageList.Width;
      StretchedBMP.Height := ImageList.Height;
    
      // Prepare the memory stream
      MS := TMemoryStream.Create;
      try
        ImageBitmap:= TBitmap.Create;
        try
          while not ItemsDts.Eof do
          begin
            if not ItemsDtsPicture.IsNull then
            begin
              MS.Size := 0;
              ItemsDtsPicture.SaveToStream(MS);
              MS.Position := 0;
              ImageBitmap.LoadFromStream(MS);
              // Stretch the image
              StretchedBMP.Canvas.StretchDraw(Rect(0, 0, StretchedBmp.Width-1, StretchedBmp.Height-1), ImageBitmap);
              ImageList.Add(StretchedBmp, nil);
            end;
            ItemsDts.Next;
          end;
        finally MS.Free;
        end;
      finally StretchedBMP.Free;
      end;
    finally
      ImageBitmap.Free;
    end;
    

    PS: I edited your code in the browser’s window. I can’t guarantee it compiles, but if it doesn’t, it should be easy to fix.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in which each of its TD contains image (more precisely,
I have a table with two columns - the key contains the image name,
I have 3 tables. Table A contains the data that my query is going
I have one table that has Image Data type column, that column contains Pdf
I have two tables that can be seen in accompanying image. Table A contains
I have a table contains multiple rows and each row has an image. <table>
I have the following code, and my table(the table contains the two text lines
I have two table cells. The first contains a link and an image (CollegiateLink).
I have table which contains double values stored in mysql database ...I need to
I have a table on my database called 'Log'. This Log table contains ID,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.