Image in Listbox

Is it possible to display and image in a listbox column?

It depends. You can use the CellBackgroundPaint event to draw a picture into each cell in a column, but drawing a single picture into an entire column would require manually splitting the pic into regions for each Cell.

Each cell in a column is what I meant. Thank you Andrew.

I’m populating a cell with an image from a database. How do I determine if there is an image (some of the data will be null)?

How do I specify the cell column to put the image? I was trying the g.DrawPicture which has an x y position reference and now a row column.


The CELLBACKGROUNDPAINT event tells you what row and colum is being painted

if row=theRowIwant and column=theColumnIwant then g.drawpicture mypicture,0,0

You can use the RowPicture method to put a picture in the first column. For more precise control you can use the CellBackgroundPaint event to draw what you want in any cell.

Xojo includes many ListBox example projects that have picture drawing: Examples/Desktop/Controls/ListBox

Also see:

Thanks Paul and Dave. Both were helpful. I did figure out if my image is too big, it doesn’t appear. I have to resize the image to 16x16 to show as I wanted.

Or enlarge RowHeight…