You need to read the meta data of the image, this is best done via either QuickLook or CGImageSource. You can of course load the image via pure Xojo and generate a thumbnail, but this is far too slow.
Check out the MacOsLib or MBS for either of the above.
Lastly, I wouldn’t recommend using rowPicture as it’s not retina compatible. Instead use the cellTag property to store the retina ready picture and then in the celltextPaint event check to see if the cell has a tag and if so then check to see if it’s a picture, before you try to draw it at the correct size.
Reading the images from disc to generate a thumbnail is slow, but there will be a big hit if you do it in the CelltextPaint every time.
Sam’s idea is a good place to start.
Instead use the cellTag property to store the retina ready picture and then in the celltextPaint event check to see if the cell has a tag and if so then check to see if it’s a picture, before you try to draw it at the correct size.<<[/i]
I have used a slightly different method on some of my projects.
The list can be quickly filled with a list of files. Either you show the file name, or you can have it in an invisible column.
In the cellTextPaint event check the cell tag property: if it contains the thumbnail picture, display it, otherwise read the image, resize it, put it in the row tag property and then display it.
On first display, this means you get a hit for all visible rows.
Fire off a thread which checks the rowtag property of the whole listbox, and populate the row tag property with a thumbnail where it is missing.
That way, when the user scrolls the list to a new area, the thread may already have filled the row tag property and the list can scroll with little delay.
If the list of files is fixed / known in advance, you could use a thread to populate an array of thumbnail pictures at any time.
When your listbox is displayed, it can take its images from the array, which should already be full by that time.
I do not read the solution people gaves you, but in this case, you have to create a Method who loads the image, resize it to Thumbnails and display that for all images you fall into / needs a Thumbnail.
Watch Picture / Graphics (DrawPicture); how to resize a Picture in the documentation. Do not forget to resize keeping the width / Height ratio.