That gives me the length of the string if it is placed into a text box. I need to determine how many lines it will be if i give it a certain width maximum when printed, and it word wraps onto another line.
The original data is being entered in from a Rich Text Box, and stored into a memo field in MS Access. Because the Rich Text Box from the form is word wrapping, the users never have to hit enter, making the text stored in the memo field one long string with no line breaks.
Right now, I am printing the text out into a RectangleF, which permits it to word wrap, but i cannot determine how to set the height so that I display all the data in the memo field. It is that height requirement that I am ultimately needing, and not necessarily the number of lines it will print out, but that would help me with other portions of the report.
Main Topics
Browse All Topics





by: kalliopiPosted on 2005-09-06 at 17:03:18ID: 14833189
This shoud work.
asureStrin g(TextBox1 .Text, TextBox1.Font, f)
Dim f As System.Drawing.SizeF
f.Height = TextBox1.Size.Height
f.Width = TextBox1.Size.Width
f = TextBox1.CreateGraphics.Me
TextBox1.Height = f.Height
TextBox1.Width = f.Width