Printing TextBox - Difference in spaces and tabs

poets

Member
Joined
May 22, 2006
Messages
9
Programming Experience
Beginner
Nice day to all,
does anybody know how to solve my problem ?

I try to print the TextBox control using my printiclass which includes this code. Everything seemed to be Ok until I have found there is an difference in gaps shown in textbox and finally seen in print preview.

_____________________
Private Sub DrawTextBox(ByVal txt As TextBox, ByVal p As Point, ByVal g As Graphics)
txt.Font = New Font("Times New Roman", 11, FontStyle.Regular, GraphicsUnit.Point, 238)
g.DrawString(txt.Text, txt.Font, New SolidBrush(txt.ForeColor), p.X, p.Y)

End Sub

_____________________

To ensure I use the same font a set the font manually directly before print.
If I compare the letters, they all seem to be of same size and format but there is a problem if the string contains in one row some TABS or gaps + text and the next row is usualy like this.

text txt text
text txt text
:eek:
I do not understand this drawString method, does it make sense that while there is used the same font in text box and in this method that these gaps are not of same size ?

Thank you for any response !!
 
Top Bottom