Word wrap in ListBox?

Is there a way to wrap words in a ListBox cell when the text is too long to be seen in its entirety, automatically deepening the row to fit the wrapped text?

RowHeight is variable, but it affects ALL rows. Not just a single row.

You can do your own text drawing using the CellTextDraw event. So you can do pretty much whatever you have the heart to do.

Thanks for the reply. Yes, I’m aware of CellTextDraw, I was just hoping for a simpler method :slight_smile:

You can use CellTextDraw only when the text is too long.

Then it becomes very simple :

Function CellTextPaint(g As Graphics, row As Integer, column As Integer, x as Integer, y as Integer) Handles CellTextPaint as Boolean if g.stringwidth(me.cell(row,column)) > g.width then g.drawstring(me.cell(row,column), 2, g.height*0.4, g.width-3) return true end if End Function

Make sure to have enough DefaultRowHeight for text to wrap.

It’s possible there is a 3rd party solution that does this automatically. I don’t know of any but perhaps someone else knows.

Karen’s Mergeable Cell Listbox does it (and many other things)
http://katkosoft.com/Mergeable%20Listbox%20Page/MergeableCellListbox.html

Thank you all for your replies.