Hi. everybody.
First of all, i know that listbox doesn’t have the ability to set a width for each row. For example for two rows, you need to set it to 40px.
And I read that I can use the G.drawstring to draw the lines of text desired.
So thats my idea: measure the LEN of a string, for example---- a big phrase that have 150 characters including spaces.
The size of my column will have one fixed width.
and only fits, for example 50 characters per line.
The idea is to split the source string in parts of 50 characters. (in this case in 3 parts or pieces).
like this:
Select case Column
//Para las Columnas 3, 4 asignar formato de moneda
case 2
dim texto as String = me.Cell(row, column)
dim source as string = texto
dim dest() as string
while len(source) > 0 // while there are still characters left in the string
dest.append(left(source, 20)) // put each set of twenty characters into an array element
source = right(source, len(source) - 20) // and strip off the twenty that were just put into the array
wend
'Msgbox dest(1) 67
For i As Integer = 0 to dest.Ubound
g.drawString dest(0), x, y
'g.drawString str(dest.Ubound), x, y
g.DrawString chr(13) + dest(1), x, y
return true
Next
End Select
As you can see I use a Select Case for only draw in the column 2.
Then I think to use a FOR in order to parse through the items on the array. like: Drawstring dest(0)
drawstring chr(13)+dest(1)
When I choose the values on the array It works, but when I use the for doesn’t work. What Am I doing wrong?
Thanks
P. D. I’m using the Celltextpaint event of the listbox