Multiline string in a cell (listbox)

My task for today is (was) to find a good way to display a multiline string in a cell. I want to display 2 or 3 lines of text.

Started on Mac with TextField, using Ctrl + Enter to add new lines, making the rows height bigger, then assign textfield as addrow, just to find out that the information is displayed but the first line is at the middle of the cell. I wanted all 3 lines centered (the TextField contents = This is line #1Ctrl+EnterThis is line #2Ctrl+EnterThis is line #3):

Then I changed TextField and used TextArea, again with Ctrl + Enter:

Moved to Windows and I can’t use Ctrl + Enter.

Back on Mac with TextArea and using regular Enter. Changed CellType = 4. Even when the listbox only display the first line, if I enter the cell’s edit mode, it display all 3 lines:

After searching for a while, I found information about CellTextPaint. I used the next code there:

Dim arr() As String = Split(Me.Cell(row, column), EndOfLine) g.DrawString(arr(0), x, y - g.TextHeight ) g.DrawString(arr(1), x, y) g.DrawString(arr(2), x, y + g.TextHeight) Return True

I got outofbound errors if I have only 0-2 lines, so I changed the code to:

Dim arr() As String = Split(Me.Cell(row, column), EndOfLine) For i As Integer = 0 To ubound(arr) g.DrawString(arr(i), x, y - g.TextHeight + i * g.TextHeight) next Return True

If I change the height to only show 3 lines and only have 1 line, it will show at the top; 2 will show top and middle and 3 top/middle/bottom. I think I can change that but I think it’s ok.

At this point I don’t need different heights for each row. I read that there are a couple of plugins to do that.

Is this the simplest way to show 2-3 lines of text in a cell?

Note: I think I can’t add lines of text once the information is in the cell. If I press Enter (Return) the editing is finished. I guess the workaround it to open the cell contents into a TextArea, edit there and update the cell