How to make longest string into more rows in printDocument?

  • Thread starter Thread starter Kwok
  • Start date Start date
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.
 
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
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
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
 
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
 
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))
 
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
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
Back
Top