I have a function to print a listbox and I have a function to word wrap a string to a set number of characters.
Some columns in the listbox have text which needs to wrap on the next line. Done no problem.
After that I want the next listbox row to print below the last bit of word-wrapped text.
I presume I need to measure the height of the word wrapped text and add that to my y position. How do I do that.
[code]
'Leave top margin then print header
yRow = 72
printHeader(listboxName,g,firstColumn,strHeader)
g.Bold = false
yRow = yRow + 4
g.DrawLine 0, yRow, g.width, yRow // draw a line under header
For yCounter =0 to listboxName.ListCount - 1
x =20
yRow = yRow + g.TextSize + 2
For xCounter = firstColumn to listboxName.ColumnCount - 1
if listboxName.Column(xcounter).WidthActual <> 0 then //don’t print hidden columns
dim wrappedString as string = WordWrap(listboxName.Cell(yCounter, xCounter),20) // wrap text to max 20 characters
g.DrawString (wrappedString, x, yRow)
if instr(0,wrappedString,chr(13))<> 0 then // test if text needed wrap
yRow = yrow + ??? //Set y for next row
end if
end if
xColumnWidth =listboxName.Column(xcounter).WidthActual
x = x + xColumnWidth
Next xCounter[/code]