How to make longest string into more rows in printDocument?

K

Kwok

Hi All,

I want to make the longest string value (it probables more
than 300 words.) to more rows to print it using
printDocument.

How do i do it like WORD that it auto cut string value at
space character.
 
N

Nak

I want to make the longest string value (it probables more
than 300 words.) to more rows to print it using
printDocument.

How do i do it like WORD that it auto cut string value at
space character.

Hi there,

I'm not quite sure that I understand what you are after. A string
doesn't get *cut*, it contains characters to make a new line, space etc.
these characters are used in visual basic by using constants. What are you
displaying the string in? a text box? a rich text box? Try the following to
add a new line to a string...

Dim mystring as string = "This is a string." & ControlChars.CrLf & "This is
on the next line"

The only reason you actually get new lines, spaces etc is down to the
contol that your putting the string into, in essence a string is simply a
load of values joined together, for ASCII the values are bytes in the range
of 0 to 255. Look up "Print and display constants" in the documentation :)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
C

Cor

Hi Kwok,
I don't understand this, will you explain something more what you mean with
this?
How do i do it like WORD that it auto cut string value at
space character.
Cor
 
F

Fergus Cooney

Hi Guys,

Kwok wants to do word-wrap of paragraphs stored in a single string.

I'm too tired to explain about (harder method) measuring strings in a
given font that will match the printer, or (easier method) counting characters
and then finding the nearest space or other word-break character.

G'night,
Fergus
 
A

Armin Zingler

Kwok said:
I want to make the longest string value (it probables more
than 300 words.) to more rows to print it using
printDocument.

How do i do it like WORD that it auto cut string value at
space character.

Use the version of DrawString that takes a Layout-Rectangle. Example:

Graphics.DrawString(<myString>, Me.Font, Brushes.Black, New RectangleF(0, 0,
150, 500))
 
N

Nak

Give Nick, Fergus and Herfried a nice item and you got the longest strings
of the world.

LOL

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top