Image width limit for ListBox RowPicture images?

I’ve just noticed that my RowPicture images above 22x22 are starting to clip on the left edge of the listbox. Is there a width limit that we should be aware of when assigning a RowPicture?

CellWidth ?

Pretty sure 16 x 16 is the biggest safe size.
I usually drawpicture in the cellbackgroundpaint event instead.
Adding the ‘icon’ to the rowtag is as easy as assigning a rowpicture

list.additem "hello" list.rowtag(list.lastindex) = myicon

…then in the cellbackgroundpaint, assuming a square icon

dim p as picture if col = 0 then p = me.rowtag(row) g.drawpicture p, 1,1, g.height -2 ,g.height -2 ,0,0, p. width, p.height end if

What I’ve uncovered as of last night. It just looks odd when I’m using tall rows to support touch screens. Looks like the CellBackgroundPaint is the only way to sort this. I’ll have to also update the ColumnAlignmentOffset so the text is drawn properly offset.

isn’t the max picture width equal to the rowheight of the listbox ?

That is what I had Assumed, but apparently not.

What I have done is just forego CellTextPaint (return true), and do all the drawing (icons, text etc) in CellBackgroundPaint
this way you have full control … icons positioned where you want, the size you want… multiple lines of text, different colors etc.

[quote=424226:@Dave S]What I have done is just forego CellTextPaint (return true), and do all the drawing (icons, text etc) in CellBackgroundPaint
this way you have full control … icons positioned where you want, the size you want… multiple lines of text, different colors etc.[/quote]
That works, but I’m also trying to let the automatic handling of dark versus light modes do their thing.

I don’t think it’s documented anywhere but 20 x 20 seems to be about the maximum size you should use before you start to get clipping on the left.