M
MikeG0930
I have a report that get's it's data from a form. One of the fields in the
report is for hobbies that I want to limit to the size of the region of a
rectangle. To do this, I am using this code:
Call DrawStringInBox(ev, 50, msngYPos, _
50, msngYPos + msngFontHeight, _
txtHobbies.Text)
Private Sub DrawStringInBox( _
ByVal ev As System.Drawing.Printing.PrintPageEventArgs, _
ByVal x1 As Single, ByVal y1 As Single, _
ByVal x2 As Single, ByVal y2 As Single, _
ByVal s As String)
Dim sfCurrent As New StringFormat()
Dim recCurrent As New RectangleF(x1, y1, x2, y2)
sfCurrent.Trimming = StringTrimming.Character
sfCurrent.Alignment = StringAlignment.Near
ev.Graphics.DrawString(s, mfntPrint, _
Brushes.Black, recCurrent, sfCurrent)
End Sub
The problem is instead of truncating the text to the nearest character, it
wordwraps to a new line.
Thanks for any help.
report is for hobbies that I want to limit to the size of the region of a
rectangle. To do this, I am using this code:
Call DrawStringInBox(ev, 50, msngYPos, _
50, msngYPos + msngFontHeight, _
txtHobbies.Text)
Private Sub DrawStringInBox( _
ByVal ev As System.Drawing.Printing.PrintPageEventArgs, _
ByVal x1 As Single, ByVal y1 As Single, _
ByVal x2 As Single, ByVal y2 As Single, _
ByVal s As String)
Dim sfCurrent As New StringFormat()
Dim recCurrent As New RectangleF(x1, y1, x2, y2)
sfCurrent.Trimming = StringTrimming.Character
sfCurrent.Alignment = StringAlignment.Near
ev.Graphics.DrawString(s, mfntPrint, _
Brushes.Black, recCurrent, sfCurrent)
End Sub
The problem is instead of truncating the text to the nearest character, it
wordwraps to a new line.
Thanks for any help.