The 'single word' word wrap that Zionworx gives can look a bit naff sometimes. I was wondering if you could do something clever with font size.
I actually started writing some display software in MS Access and did something like this looking at the number of lines to display and the maximum number of characters per line:
Function fontsizer(mystring As String) As Integer
'works out the optimum font size based on the number of lines and the maximum line width
Dim font1
Dim font2
font1 = 40
font2 = 40
If lines(mystring) > 8 Then font1 = Int(40 - ((lines(mystring) - 8) * 3))
If maxwidth(mystring) > 40 Then font2 = Int(40 - (((maxwidth(mystring) - 40) * 0.55)))
If font2 > font1 Then
fontsizer = font1
Else
fontsizer = font2
End If
End Function
Function maxwidth(mystring As String) As Integer
'finds the maximum width of a multi line text string
Dim position As Integer
Dim position2 As Integer
Dim lastpos As Integer
position = 0
position2 = 1
maxwidth = 0
position = InStr(1, mystring, Chr(10), vbBinaryCompare)
If position = 0 Then maxwidth = Len(mystring)
While position > 0 'I have found another new line character
If position - position2 > maxwidth Then
maxwidth = position - position2
End If
position2 = position + 1
lastpos = position
position = InStr(position2, mystring, Chr(10), vbBinaryCompare)
Wend
If Len(mystring) - lastpos > maxwidth Then maxwidth = Len(mystring) - lastpos
End Function
Function lines(mystring As String) As Integer
'finds the number of lines in a multi line text stringDim position
Dim position As Integer
Dim position2 As Integer
position = 0
position2 = 1
lines = 1
position = InStr(1, mystring, Chr(10), vbBinaryCompare)
While position > 0 'I have found another new line character
lines = lines + 1
position2 = position + 1
position = InStr(position2, mystring, Chr(10), vbBinaryCompare)
Wend
End Function
I guess that the number of lines is not too critical but if a font size reduction of 5% would fit in that last offending word then an automatic option (in preferences) might be really nice.
By the way guys, keep up the good work. This is a fantastic product.
God Bless.
Geof H
Brent Methodist Church, Dartford.